views_filters_selective.module in Views Selective Filters 7
Views Fiters Selective Module.
File
views_filters_selective.moduleView source
<?php
/**
* @file
* Views Fiters Selective Module.
*/
/**
* Implements hook_views_api().
*/
function views_filters_selective_views_api() {
return array(
'api' => 3.0,
);
}
/**
* Implements hook_views_ajax_data_alter().
*/
function views_filters_selective_views_ajax_data_alter(&$commands, $view) {
// Only refresh if at least one of the filters is of type selective
// in order to minimize impact of any possible bug.
if (!empty($view->using_selective)) {
$exposed_block_plugin = $view->display_handler
->get_plugin('exposed_form');
// Generated as in views.module::views_exposed_form().
$block_id = drupal_clean_css_identifier('views_exposed_form-' . check_plain($view->name) . '-' . check_plain($view->display_handler->display->id));
$commands[] = ajax_command_replace('#' . $block_id, $exposed_block_plugin
->render_exposed_form(TRUE));
// To make submit work after ajax (https://drupal.org/node/2182885).
$commands[] = ajax_command_invoke(NULL, "attachBehaviors");
}
}
Functions
Name | Description |
---|---|
views_filters_selective_views_ajax_data_alter | Implements hook_views_ajax_data_alter(). |
views_filters_selective_views_api | Implements hook_views_api(). |