You are here

views_block_filter_block.module in Views Block Exposed Filter Blocks 7

Same filename and directory in other branches
  1. 8 views_block_filter_block.module

Hooks and functions for the Views Block Exposed Filter Block module.

File

views_block_filter_block.module
View source
<?php

/**
 * @file
 * Hooks and functions for the Views Block Exposed Filter Block module.
 */

/**
 * Implements hook_views_api().
 */
function views_block_filter_block_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'views_block_filter_block') . '/includes',
  );
}

/**
 * Implements hook_form_FORM_ID_alter().
 */
function views_block_filter_block_form_views_exposed_form_alter(&$form, &$form_state) {
  $view = $form_state['view'];

  // Only react on block Views specifically configured with exposed form blocks.
  if (get_class($view->display_handler) == 'vbfb_plugin_display_block') {
    if ($view->display_handler
      ->get_option('exposed_block')) {

      // Ensure that the fallback form action is the current page.
      $form['#action'] = url(drupal_get_path_alias(), array(
        'absolute' => TRUE,
      ));
    }
  }
}