class views_plugin_exposed_form_input_required
Same name in other branches
- 6.x-3.x plugins/views_plugin_exposed_form_input_required.inc \views_plugin_exposed_form_input_required
Exposed form plugin that provides an exposed form with required input.
Hierarchy
- class \views_object
- class \views_plugin extends \views_object
- class \views_plugin_exposed_form extends \views_plugin
- class \views_plugin_exposed_form_input_required extends \views_plugin_exposed_form
- class \views_plugin_exposed_form extends \views_plugin
- class \views_plugin extends \views_object
Expanded class hierarchy of views_plugin_exposed_form_input_required
Related topics
1 string reference to 'views_plugin_exposed_form_input_required'
- views_views_plugins in includes/
plugins.inc - Implements hook_views_plugins().
File
-
plugins/
views_plugin_exposed_form_input_required.inc, line 13
View source
class views_plugin_exposed_form_input_required extends views_plugin_exposed_form {
/**
* {@inheritdoc}
*/
public function option_definition() {
$options = parent::option_definition();
$options['text_input_required'] = array(
'default' => 'Select any filter and click on Apply to see results',
'translatable' => TRUE,
);
$options['text_input_required_format'] = array(
'default' => NULL,
);
return $options;
}
/**
* {@inheritdoc}
*/
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['text_input_required'] = array(
'#type' => 'text_format',
'#title' => t('Text on demand'),
'#description' => t('Text to display instead of results until the user selects and applies an exposed filter.'),
'#default_value' => $this->options['text_input_required'],
'#format' => isset($this->options['text_input_required_format']) ? $this->options['text_input_required_format'] : filter_default_format(),
'#wysiwyg' => FALSE,
);
}
/**
* {@inheritdoc}
*/
public function options_submit(&$form, &$form_state) {
$form_state['values']['exposed_form_options']['text_input_required_format'] = $form_state['values']['exposed_form_options']['text_input_required']['format'];
$form_state['values']['exposed_form_options']['text_input_required'] = $form_state['values']['exposed_form_options']['text_input_required']['value'];
parent::options_submit($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function exposed_filter_applied() {
static $cache = NULL;
if (!isset($cache)) {
$view = $this->view;
if (is_array($view->filter) && count($view->filter)) {
foreach ($view->filter as $filter) {
if ($filter->is_exposed()) {
$identifier = $filter->options['expose']['identifier'];
if (isset($view->exposed_input[$identifier])) {
$cache = TRUE;
return $cache;
}
}
}
}
$cache = FALSE;
}
return $cache;
}
/**
* {@inheritdoc}
*/
public function pre_render($values) {
if (!$this->exposed_filter_applied()) {
$options = array(
'id' => 'area',
'table' => 'views',
'field' => 'area',
'label' => '',
'relationship' => 'none',
'group_type' => 'group',
'content' => $this->options['text_input_required'],
'format' => $this->options['text_input_required_format'],
'empty' => TRUE,
);
$handler = views_get_handler('views', 'area', 'area');
$handler->init($this->view, $options);
$this->display->handler->handlers['empty'] = array(
'area' => $handler,
);
$this->display->handler
->set_option('empty', array(
'text' => $options,
));
}
}
/**
* {@inheritdoc}
*/
public function query() {
if (!$this->exposed_filter_applied()) {
// We return with no query; this will force the empty text.
$this->view->built = TRUE;
$this->view->executed = TRUE;
$this->view->result = array();
}
else {
parent::query();
}
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
views_object::$definition | public | property | Handler's definition. | |||
views_object::$options | public | property | Except for displays, options for the object will be held here. | 1 | ||
views_object::altered_option_definition | public | function | Collect this handler's option definition and alter them, ready for use. | |||
views_object::construct | public | function | Views handlers use a special construct function. | 4 | ||
views_object::destroy | public | function | Destructor. | 2 | ||
views_object::export_option | public | function | 1 | |||
views_object::export_options | public | function | ||||
views_object::export_option_always | public | function | Always exports the option, regardless of the default value. | |||
views_object::options | Deprecated | public | function | Set default options on this object. | 1 | |
views_object::set_default_options | public | function | Set default options. | |||
views_object::set_definition | public | function | Let the handler know what its full definition is. | |||
views_object::unpack_options | public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. |
|||
views_object::unpack_translatable | public | function | Unpack a single option definition. | |||
views_object::unpack_translatables | public | function | Unpacks each handler to store translatable texts. | |||
views_object::_set_option_defaults | public | function | ||||
views_plugin::$display | public | property | The current used views display. | |||
views_plugin::$plugin_name | public | property | The plugin name of this plugin, for example table or full. | |||
views_plugin::$plugin_type | public | property | The plugin type of this plugin, for example style or query. | |||
views_plugin::$view | public | property | The top object of a view. | Overrides views_object::$view | 1 | |
views_plugin::additional_theme_functions | public | function | Provide a list of additional theme functions for the theme info page. | |||
views_plugin::options_validate | public | function | Validate the options form. | 10 | ||
views_plugin::plugin_title | public | function | Return the human readable name of the display. | |||
views_plugin::summary_title | public | function | Returns the summary of the settings in the display. | 8 | ||
views_plugin::theme_functions | public | function | Provide a full list of possible theme templates used by this style. | |||
views_plugin::validate | public | function | Validate that the plugin is correct and can be saved. | 3 | ||
views_plugin_exposed_form::exposed_form_alter | public | function | ||||
views_plugin_exposed_form::exposed_form_submit | public | function | This function is executed when exposed form is submited. | |||
views_plugin_exposed_form::exposed_form_validate | public | function | ||||
views_plugin_exposed_form::init | public | function | Initialize the plugin. | |||
views_plugin_exposed_form::post_execute | public | function | ||||
views_plugin_exposed_form::post_render | public | function | ||||
views_plugin_exposed_form::pre_execute | public | function | ||||
views_plugin_exposed_form::render_exposed_form | public | function | Render the exposed filter form. | |||
views_plugin_exposed_form::reset_form | public | function | ||||
views_plugin_exposed_form_input_required::exposed_filter_applied | public | function | ||||
views_plugin_exposed_form_input_required::options_form | public | function | Provide a form to edit options for this plugin. | Overrides views_plugin_exposed_form::options_form | ||
views_plugin_exposed_form_input_required::options_submit | public | function | Handle any special handling on the validate form. | Overrides views_plugin::options_submit | ||
views_plugin_exposed_form_input_required::option_definition | public | function | Information about options for all kinds of purposes will be held here. | Overrides views_plugin_exposed_form::option_definition | ||
views_plugin_exposed_form_input_required::pre_render | public | function | Overrides views_plugin_exposed_form::pre_render | |||
views_plugin_exposed_form_input_required::query | public | function | Add anything to the query that we might need to. | Overrides views_plugin_exposed_form::query |