function context_condition_node_taxonomy::condition_form

cis7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::condition_form($context)
cle7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::condition_form($context)
elmsmedia7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::condition_form($context)
icor7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::condition_form($context)
meedjum_blog7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::condition_form($context)
mooc7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::condition_form($context)

Condition form.

Overrides context_condition::condition_form

File

sites/all/modules/ulmus/context/plugins/context_condition_node_taxonomy.inc, line 21

Class

context_condition_node_taxonomy
Expose node taxonomy terms as a context condition.

Code

function condition_form($context) {
  $form = parent::condition_form($context);
  $form['#type'] = 'select';
  $form['#size'] = 12;
  $form['#multiple'] = TRUE;
  $vocabularies = taxonomy_get_vocabularies();
  $options = array();
  foreach ($vocabularies as $vid => $vocabulary) {
    $tree = taxonomy_get_tree($vid);
    if ($tree && (count($tree) > 0)) {
      $options[$vocabulary->name] = array();
      foreach ($tree as $term) {
        $options[$vocabulary->name][$term->tid] = str_repeat('-', $term->depth) . $term->name;
      }
    }
  }
  $form['#options'] = $options;
  return $form;
}