You are here

function location_taxonomize_term_attach_check_field in Location Taxonomize 7.2

Checks the given form to make sure that the term attach field exists and is set up correctly

1 call to location_taxonomize_term_attach_check_field()
location_taxonomize_term_attach in ./location_taxonomize.module
Attaches the given tids to the node form given in form_state if they need to be attached Note that all it does is remove the old numbers and add the new ones. It's faster than checking which ones are missing and adding. Also ensures that only…

File

./location_taxonomize.inc, line 186
Some useful functions for Location taxonomize

Code

function location_taxonomize_term_attach_check_field($form) {
  $field_name = 'field_' . LT_TERM_ATTACH_FIELD;

  // make sure that a field by this name exists
  if (!isset($form[$field_name])) {
    return FALSE;
  }

  // make sure that this field has the right settings
  $field_info = field_info_field($field_name);
  if ($field_info['deleted'] == 1) {
    return FALSE;
  }
  if ($field_info['type'] != 'taxonomy_term_reference') {
    return FALSE;
  }
  if ($field_info['settings']['allowed_values'][0]['vocabulary'] != LT_MODULE_ID) {
    return FALSE;
  }
  return $field_name;
}