You are here

function mefibs_form_views_exposed_form_alter in MEFIBS - More exposed forms in blocks 8

Same name and namespace in other branches
  1. 7 mefibs.module \mefibs_form_views_exposed_form_alter()

Implements hook_form_FORM_ID_alter().

File

./mefibs.module, line 234
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'];
  $display = $view->display_handler;
  $display_id = $view->current_display;
  if (!mefibs_display_is_mefibs_enabled($display)) {
    return;
  }
  $mefibs = $display->extender['mefibs'];
  $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'];
  }

  // Hide exposed items from other form blocks.
  $mefibs
    ->hideExposedFormItems($form, $block_id);

  // Set default values to reflect the current filter states.
  $mefibs
    ->setDefaultValues($form, $block_id);
}