You are here

class views_autocomplete_filters_exposed_form_plugin in Views Autocomplete Filters 6.3

@file Provides an Views Autocomplete Filters exposed form plugin for View 3.x.

Hierarchy

Expanded class hierarchy of views_autocomplete_filters_exposed_form_plugin

File

./views_autocomplete_filters_exposed_form_plugin.inc, line 7
Provides an Views Autocomplete Filters exposed form plugin for View 3.x.

View source
class views_autocomplete_filters_exposed_form_plugin extends views_plugin_exposed_form_basic {
  function summary_title() {
    return t('Views Autocomplete Filters');
  }
  function option_definition() {
    $options = parent::option_definition();
    $options['views_autocomplete'] = array(
      'default' => array(),
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $options = array();

    // Go through each filter and add the same options we used to add in hook_form_alter()
    foreach ($this->display->handler
      ->get_handlers('filter') as $label => $filter) {
      if (!$filter->options['exposed']) {
        continue;
      }
      if (!$options_header) {
        $options['header'] = array(
          '#value' => '<strong>' . t("Autocomplete Filters") . '</strong>',
        );
      }
      $options[$label]['autocomplete_enabled'] = array(
        '#title' => t("Enable autocomplete for ") . $label,
        '#type' => 'checkbox',
        '#default_value' => $this->options['views_autocomplete'][$label]['autocomplete_enabled'],
      );
    }
    $form['views_autocomplete'] = $options;
  }
  function exposed_form_alter(&$form, &$form_state) {
    parent::exposed_form_alter($form, $form_state);
    $filters = $form_state['view']->display_handler->handlers['filter'];
    foreach ($filters as $label => $filter) {
      if ($filter->options['exposed'] && $this->options['views_autocomplete'][$label]['autocomplete_enabled']) {
        $form[$label]['#autocomplete_path'] = 'autocomplete_filter/' . $label . '/' . $this->view->name . '/' . $this->view->current_display;
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_autocomplete_filters_exposed_form_plugin::exposed_form_alter function Overrides views_plugin_exposed_form::exposed_form_alter
views_autocomplete_filters_exposed_form_plugin::options_form function Provide a form to edit options for this plugin. Overrides views_plugin_exposed_form::options_form
views_autocomplete_filters_exposed_form_plugin::option_definition function Information about options for all kinds of purposes will be held here. Overrides views_plugin_exposed_form::option_definition
views_autocomplete_filters_exposed_form_plugin::summary_title function Return a string to display as the clickable title for the control. Overrides views_plugin_exposed_form_basic::summary_title
views_object::$definition property Handler's definition
views_object::$options property Except for displays, options for the object will be held here. 1
views_object::construct function Views handlers use a special construct function so that we can more easily construct them with variable arguments. 6
views_object::destroy function 2
views_object::export_option function 1
views_object::export_options function
views_object::options function Set default options on this object. Called by the constructor in a complex chain to deal with backward compatibility. 1
views_object::set_default_options function Set default options. For backward compatibility, it sends the options array; this is a feature that will likely disappear at some point.
views_object::set_definition function Let the handler know what its full definition is.
views_object::unpack_options function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
views_object::unpack_translatable function Unpack a single option definition.
views_object::unpack_translatables function Unpacks each handler to store translatable texts.
views_object::_set_option_defaults function
views_plugin::$display property The current used views display.
views_plugin::$plugin_type property The plugin type of this plugin, for example style or query.
views_plugin::$view property The top object of a view. Overrides views_object::$view 1
views_plugin::additional_theme_functions function Provide a list of additional theme functions for the theme information page
views_plugin::options_submit function Handle any special handling on the validate form. 9
views_plugin::options_validate function Validate the options form. 8
views_plugin::theme_functions function Provide a full list of possible theme templates used by this style.
views_plugin::validate function Validate that the plugin is correct and can be saved. 2
views_plugin_exposed_form::exposed_form_submit function This function is executed when exposed form is submited.
views_plugin_exposed_form::exposed_form_validate function
views_plugin_exposed_form::init function Initialize the plugin.
views_plugin_exposed_form::post_render function
views_plugin_exposed_form::pre_execute function
views_plugin_exposed_form::pre_render function 1
views_plugin_exposed_form::query function Add anything to the query that we might need to. Overrides views_plugin::query 1
views_plugin_exposed_form::render_exposed_form function Render the exposed filter form.
views_plugin_exposed_form::reset_form function Provide a reset form if one was requested.