function mefibs_form_views_exposed_form_alter in MEFIBS - More exposed forms in blocks 7
Same name and namespace in other branches
- 8 mefibs.module \mefibs_form_views_exposed_form_alter()
Implements hook_form_FORM_ID_alter().
File
- ./
mefibs.module, line 554 - Primarily Drupal hooks and global API functions to manipulate views and to provide an additional block with an exposed filter form.
Code
function mefibs_form_views_exposed_form_alter(&$form, $form_state) {
$view = $form_state['view'];
if (!mefibs_display_is_mefibs_enabled($view->display_handler)) {
return;
}
$block_id = 'default';
if (isset($form_state['exposed_form_override']) && isset($form_state['mefibs_block_id'])) {
$form['mefibs_block_id'] = array(
'#type' => 'hidden',
'#name' => 'mefibs_block_id',
'#value' => $form_state['mefibs_block_id'],
);
$block_id = $form_state['mefibs_block_id'];
}
if ($block_id == 'default') {
// Add necessary info to JS settings.
drupal_add_js(array(
'mefibs' => array(
'forms' => array(
'default' => array(
'view_name' => $view->name,
'view_display_id' => $view->current_display,
'form_prefix' => '',
),
),
),
), 'setting');
}
// Hide exposed items from other form blocks.
mefibs_hide_exposed_form_items($form, $view, $block_id);
// Set default values to reflect the current filter states.
mefibs_set_default_values($form, $view, $block_id);
array_unshift($form['#submit'], 'mefibs_exposed_block_form_submit');
}