Fix for Setting view title when using a custom validator for a taxonomy_content field

  1. $handler->override_option('arguments', array(
  2.   'field_category_value' => array(
  3.     'default_action' => 'not found',
  4.     'style_plugin' => 'default_summary',
  5.     'style_options' => array(),
  6.     'wildcard' => 'all',
  7.     'wildcard_substitution' => 'Tous / Toutes',
  8.     'title' => '%1',
  9.     'breadcrumb' => '',
  10.     'default_argument_type' => 'fixed',
  11.     'default_argument' => '',
  12.     'validate_type' => 'php',
  13.     'validate_fail' => 'not found',
  14.     'break_phrase' => 0,
  15.     'not' => 0,
  16.     'id' => 'field_category_value',
  17.     'table' => 'node_data_field_category',
  18.     'field' => 'field_category_value',
  19.     'validate_user_argument_type' => 'uid',
  20.     'validate_user_roles' => array(
  21.       '2' => 0,
  22.     ),
  23.     'override' => array(
  24.       'button' => 'Utiliser la valeur par défaut',
  25.     ),
  26.     'relationship' => 'none',
  27.     'default_options_div_prefix' => '',
  28.     'default_argument_user' => 0,
  29.     'default_argument_fixed' => '',
  30.     'default_argument_php' => '',
  31.     'validate_argument_node_type' => array(
  32.       'page' => 0
  33.     ),
  34.     'validate_argument_node_access' => 0,
  35.     'validate_argument_nid_type' => 'nid',
  36.     'validate_argument_vocabulary' => array(
  37.       '2' => 2,
  38.       '1' => 0,
  39.       '3' => 0,
  40.     ),
  41.     'validate_argument_type' => 'name',
  42.     'validate_argument_transform' => 0,
  43.     'validate_user_restrict_roles' => 0,
  44.     'validate_argument_php' => '$terms = taxonomy_get_term_by_name($argument);
  45. $synonym_root = taxonomy_get_synonym_root($argument);
  46. if($synonym_root) $terms[] = $synonym_root;
  47. foreach($terms as $term) {
  48.  $parents = taxonomy_get_parents_all($term->tid);
  49.  foreach($parents as $parent) {
  50.    if($parent->name == REQUIRED_PARENT_NAME) {
  51.      $handler->argument = $term->tid;
  52.      return TRUE;
  53.    }
  54.  }
  55. }
  56. return FALSE;',
  57.   ),
  58. ));

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.