function hs_taxonomy_views_form_alter in Hierarchical Select 6.3
Same name and namespace in other branches
- 5.3 modules/hs_taxonomy_views.module \hs_taxonomy_views_form_alter()
Implementation of hook_form_alter().
File
- modules/
hs_taxonomy_views.module, line 47 - Implementation of the Hierarchical Select API for the Taxonomy module's Views exposed filters.
Code
function hs_taxonomy_views_form_alter(&$form, $form_state, $form_id) {
//
if ($form_id == 'views_ui_edit_view_form') {
// Add JS and CSS required for Hierarchical Select to work.
_hierarchical_select_setup_js();
// Ensure that Drupal.HierarchicalSelect.prepareGETSubmit() gets called.
require_once drupal_get_path('module', 'hierarchical_select') . '/includes/common.inc';
hierarchical_select_common_add_views_js();
}
if ($form_id == 'views_ui_config_item_form' && $form_state['type'] == 'filter' && $form_state['handler']->table == 'term_node' && $form_state['handler']->field == 'tid') {
require_once drupal_get_path('module', 'hierarchical_select') . '/includes/common.inc';
$view_name = $form_state['view']->name;
$filter_id = $form_state['id'];
$display_id = _hs_taxonomy_views_get_display_id_for_filter($form_state['view'], $filter_id);
$config_id = "taxonomy-views-{$view_name}-{$display_id}-{$filter_id}";
$config = hierarchical_select_common_config_get($config_id);
if ($config['save_lineage']) {
$description = t("Managed by Hierarchical Select because the 'Save lineage' setting is enabled.");
// "Operator"
$form['options']['operator']['#disabled'] = TRUE;
$form['options']['operator']['#description'] = $description;
// "Unlock operator"
$form['options']['expose']['use_operator']['#disabled'] = TRUE;
$form['options']['expose']['use_operator']['#description'] = $description;
// "Operator identifier"
$form['options']['expose']['operator']['#disabled'] = TRUE;
$form['options']['expose']['operator']['#description'] = $description;
}
}
}