You are here

function bulk_photo_nodes_taxonomy_validate in Bulk File Nodes 7

Validates selected taxonomy terms.

@todo: Since applying the patch at https://www.drupal.org/node/2278141#comment-9299441 (commit id 3c17363b01e6b4cff64544bb85bd9418c73c7ccd) 'tid' was changed to 'target_id' here, so bulk_photo_nodes_taxonomy_validate() is now acting on entity reference fields, and NOT on taxonomy reference fields. Need to figure out which reference fields this should actually be acting on, and whether the function should be renamed. See bulk_photo_nodes_recursive_ajax().

Note also that select list validation issues may be related to https://www.drupal.org/node/2454031.

1 string reference to 'bulk_photo_nodes_taxonomy_validate'
bulk_photo_nodes_recursive_ajax in ./bulk_photo_nodes.module
Adds an #ajax property recursively to all elements of a form.

File

./bulk_photo_nodes.module, line 902
hooks and helper functions for bulk photo node.

Code

function bulk_photo_nodes_taxonomy_validate(&$element, &$form_state) {
  if ($element['#value'] !== '_none') {
    $term = array(
      0 => array(
        'target_id' => is_array($element['#value']) ? reset($element['#value']) : $element['#value'],
      ),
    );
    form_set_value($element, $term, $form_state);
  }
}