class autocomplete_widgets_basic_exposed_form_plugin in Autocomplete Widgets for Text and Number Fields 6
@file Views exposed form plugin for Autocomplete Widgets module.
Hierarchy
- class \views_object
Expanded class hierarchy of autocomplete_widgets_basic_exposed_form_plugin
1 string reference to 'autocomplete_widgets_basic_exposed_form_plugin'
- autocomplete_widgets_views_plugins in views/
autocomplete_widgets.views.inc - Implementation of hook_views_plugins().
File
- views/
autocomplete_widgets_basic_exposed_form_plugin.inc, line 7 - Views exposed form plugin for Autocomplete Widgets module.
View source
class autocomplete_widgets_basic_exposed_form_plugin extends views_plugin_exposed_form_basic {
/**
* Return a string to display as the clickable title for the control.
*/
function summary_title() {
return t('Autocomplete widgets');
}
/**
* Declare custom plugin options.
*/
function option_definition() {
$options = parent::option_definition();
$options['make_autocompletable'] = array(
'default' => array(),
);
return $options;
}
/**
* Generate form elements for custom plugin options.
*/
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$relationships = $this->view->relationship;
$options = array();
foreach ($this->display->handler
->get_handlers('filter') as $filter => $handler) {
if ($handler
->is_exposed() && $handler->content_field['widget']['module'] == 'autocomplete_widgets') {
$options[$filter] = $handler
->ui_name();
if (!empty($handler->options['relationship'])) {
$relationship = $handler->options['relationship'];
if (!empty($relationships[$relationship])) {
$options[$filter] = '(' . $relationships[$relationship] . ') ' . $options[$filter];
}
}
}
}
if (!empty($options)) {
$form['make_autocompletable'] = array(
'#type' => 'checkboxes',
'#title' => t('Convert into a autocomplete widget'),
'#options' => $options,
'#default_value' => $this->options['make_autocompletable'],
'#description' => t('This list contains only exposed filters for CCK Text and Number fields.'),
);
}
}
/**
* Alter the exposed filters based on plugin options.
*/
function exposed_form_alter(&$form, &$form_state) {
parent::exposed_form_alter($form, $form_state);
if (!empty($this->options['make_autocompletable'])) {
foreach ($this->options['make_autocompletable'] as $filter) {
$field_name = $this->view->filter[$filter]->content_field['field_name'];
$type_name = $this->view->filter[$filter]->content_field['type_name'];
$form[$filter]['#autocomplete_path'] = 'autocomplete_widgets/' . $type_name . '/' . $field_name;
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
autocomplete_widgets_basic_exposed_form_plugin:: |
function |
Alter the exposed filters based on plugin options. Overrides views_plugin_exposed_form:: |
||
autocomplete_widgets_basic_exposed_form_plugin:: |
function |
Generate form elements for custom plugin options. Overrides views_plugin_exposed_form:: |
||
autocomplete_widgets_basic_exposed_form_plugin:: |
function |
Declare custom plugin options. Overrides views_plugin_exposed_form:: |
||
autocomplete_widgets_basic_exposed_form_plugin:: |
function |
Return a string to display as the clickable title for the control. Overrides views_plugin_exposed_form_basic:: |
||
views_object:: |
property | Handler's definition | ||
views_object:: |
property | Except for displays, options for the object will be held here. | 1 | |
views_object:: |
function | Views handlers use a special construct function so that we can more easily construct them with variable arguments. | 6 | |
views_object:: |
function | 2 | ||
views_object:: |
function | 1 | ||
views_object:: |
function | |||
views_object:: |
function | Set default options on this object. Called by the constructor in a complex chain to deal with backward compatibility. | 1 | |
views_object:: |
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:: |
function | Let the handler know what its full definition is. | ||
views_object:: |
function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | ||
views_object:: |
function | Unpack a single option definition. | ||
views_object:: |
function | Unpacks each handler to store translatable texts. | ||
views_object:: |
function | |||
views_plugin:: |
property | The current used views display. | ||
views_plugin:: |
property | The plugin type of this plugin, for example style or query. | ||
views_plugin:: |
property |
The top object of a view. Overrides views_object:: |
1 | |
views_plugin:: |
function | Provide a list of additional theme functions for the theme information page | ||
views_plugin:: |
function | Handle any special handling on the validate form. | 9 | |
views_plugin:: |
function | Validate the options form. | 8 | |
views_plugin:: |
function | Provide a full list of possible theme templates used by this style. | ||
views_plugin:: |
function | Validate that the plugin is correct and can be saved. | 2 | |
views_plugin_exposed_form:: |
function | This function is executed when exposed form is submited. | ||
views_plugin_exposed_form:: |
function | |||
views_plugin_exposed_form:: |
function | Initialize the plugin. | ||
views_plugin_exposed_form:: |
function | |||
views_plugin_exposed_form:: |
function | |||
views_plugin_exposed_form:: |
function | 1 | ||
views_plugin_exposed_form:: |
function |
Add anything to the query that we might need to. Overrides views_plugin:: |
1 | |
views_plugin_exposed_form:: |
function | Render the exposed filter form. | ||
views_plugin_exposed_form:: |
function | Provide a reset form if one was requested. |