Use farm_term() in place of taxonomy_get_term_by_name().
This commit is contained in:
parent
be723c1149
commit
8158d9535e
|
@ -368,8 +368,7 @@ function farm_api_restws_request_alter(array &$request) {
|
|||
$field_info = field_info_field($field_name);
|
||||
if ($field_info['type'] == 'taxonomy_term_reference') {
|
||||
if ($vocabulary = drupal_array_get_nested_value($field_info, array('settings', 'allowed_values', '0', 'vocabulary'))) {
|
||||
if ($term = taxonomy_get_term_by_name($filter_value, $vocabulary)) {
|
||||
$term = reset($term);
|
||||
if ($term = farm_term($filter_value, $vocabulary, FALSE)) {
|
||||
$_GET[$field_name] = $term->tid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,8 +239,7 @@ function farm_area_generate_form_validate(&$form, &$form_state) {
|
|||
}
|
||||
|
||||
// Load the area and store it in the form state.
|
||||
$areas = taxonomy_get_term_by_name($form_state['values']['area'], 'farm_areas');
|
||||
$area = reset($areas);
|
||||
$area = farm_term($form_state['values']['area'], 'farm_areas', FALSE);
|
||||
$form_state['storage']['area'] = $area;
|
||||
|
||||
// Ensure the area exists.
|
||||
|
|
|
@ -474,8 +474,7 @@ function farm_log_update_7008(&$sandbox) {
|
|||
foreach ($categories as $category) {
|
||||
|
||||
// Load the term.
|
||||
$terms = taxonomy_get_term_by_name($category, 'farm_log_categories');
|
||||
$term = reset($terms);
|
||||
$term = farm_term($category, 'farm_log_categories', FALSE);
|
||||
|
||||
// If the term already exists on the log, skip it.
|
||||
if (in_array($term->tid, $tids)) {
|
||||
|
|
|
@ -591,8 +591,7 @@ function farm_log_prepopulate_log_form_references(&$form) {
|
|||
$term_names = $ids;
|
||||
$ids = array();
|
||||
foreach ($term_names as $name) {
|
||||
$terms = taxonomy_get_term_by_name($name, $info['vocabulary']);
|
||||
$term = reset($terms);
|
||||
$term = farm_term($name, $info['vocabulary'], FALSE);
|
||||
if (!empty($term->tid)) {
|
||||
$ids[] = $term->tid;
|
||||
}
|
||||
|
|
|
@ -284,8 +284,7 @@ function farm_quantity_log_query($measure = NULL, $label = NULL, $start_time = 0
|
|||
// If $category is not empty, load the category ID, then join in the log
|
||||
// category field data and limit the query to logs with a matching category.
|
||||
if (!empty($category)) {
|
||||
$category_terms = taxonomy_get_term_by_name($category, 'farm_log_categories');
|
||||
$category_term = reset($category_terms);
|
||||
$category_term = farm_term($category, 'farm_log_categories', FALSE);
|
||||
if (!empty($category_term->tid)) {
|
||||
$query->innerJoin('field_data_field_farm_log_category', 'ss_fdfflc', "ss_fdfflc.entity_type = 'log' AND ss_fdfflc.entity_id = ss_log.id AND ss_fdfflc.deleted = 0");
|
||||
$query->where("ss_fdfflc.field_farm_log_category_tid = '" . $category_term->tid . "'");
|
||||
|
|
Loading…
Reference in New Issue