function views_node_taxonomy_filter_handler_filter_tid::options_form in Views Node Taxonomy Filter 7
Same name and namespace in other branches
- 6 views_node_taxonomy_filter_handler_filter_tid.inc \views_node_taxonomy_filter_handler_filter_tid::options_form()
Supply an edit form for the Filter.
Overrides views_handler_filter::options_form
File
Class
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$vocabs = array();
$result = db_query("SELECT v.vid, v.machine_name, v.name FROM {taxonomy_vocabulary} v ");
foreach ($result as $vocab) {
$vocabs[$vocab->machine_name] = $vocab->name;
}
$default_vocab = $this->options['value'][0];
$default_child = $this->options['value'][1];
$default_require = $this->options['value'][2];
$form['value'][] = array(
'#type' => 'select',
'#title' => t('Vocabulary'),
'#options' => $vocabs,
'#default_value' => $default_vocab,
'#description' => t('Select the vocabulary.'),
'#multiple' => TRUE,
);
$form['value'][] = array(
'#type' => 'checkbox',
'#title' => t('Include child terms?'),
'#default_value' => $default_child,
'#multiple' => FALSE,
);
$form['value'][] = array(
'#type' => 'checkbox',
'#title' => t('Require matching value'),
'#description' => t('If the node does not have a value for this field, no results will be shown'),
'#default_value' => $default_require,
);
}