class views_plugin_exposed_form_input_required in Views (for Drupal 7) 6.3
Same name and namespace in other branches
- 7.3 plugins/views_plugin_exposed_form_input_required.inc \views_plugin_exposed_form_input_required
Exposed form plugin that provides basic exposed form
Hierarchy
- class \views_object
- class \views_plugin
Expanded class hierarchy of views_plugin_exposed_form_input_required
1 string reference to 'views_plugin_exposed_form_input_required'
- views_views_plugins in includes/
plugins.inc - Implementation of hook_views_plugins
File
- plugins/
views_plugin_exposed_form_input_required.inc, line 6
View source
class views_plugin_exposed_form_input_required extends views_plugin_exposed_form {
function summary_title() {
return t('Input required');
}
function option_definition() {
$options = parent::option_definition();
$options['text_input_required'] = array(
'default' => t('Select any filter and click on Apply to see results'),
'translatable' => TRUE,
);
$options['text_input_required_format'] = array(
'default' => FILTER_FORMAT_DEFAULT,
);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['text_input_required'] = array(
'#type' => 'textarea',
'#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'],
);
$form['text_input_required_format'] = filter_form($this->options['text_input_required_format'], NULL, array(
'text_input_required_format',
));
}
function options_submit($form, &$form_state) {
$form_state['values']['exposed_form_options']['text_input_required_format'] = $form_state['values']['text_input_required_format'];
parent::options_submit($form, $form_state);
}
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_id => $filter) {
if ($filter
->is_exposed()) {
$identifier = $filter->options['expose']['identifier'];
if (isset($view->exposed_input[$identifier])) {
$cache = TRUE;
return $cache;
}
}
}
}
$cache = FALSE;
}
return $cache;
}
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'],
);
$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,
));
}
}
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
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 | 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 | |||
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 | Render the exposed filter form. | ||
views_plugin_exposed_form:: |
function | Provide a reset form if one was requested. | ||
views_plugin_exposed_form_input_required:: |
function | |||
views_plugin_exposed_form_input_required:: |
function |
Provide a form to edit options for this plugin. Overrides views_plugin_exposed_form:: |
||
views_plugin_exposed_form_input_required:: |
function |
Handle any special handling on the validate form. Overrides views_plugin:: |
||
views_plugin_exposed_form_input_required:: |
function |
Information about options for all kinds of purposes will be held here. Overrides views_plugin_exposed_form:: |
||
views_plugin_exposed_form_input_required:: |
function |
Overrides views_plugin_exposed_form:: |
||
views_plugin_exposed_form_input_required:: |
function |
Add anything to the query that we might need to. Overrides views_plugin_exposed_form:: |
||
views_plugin_exposed_form_input_required:: |
function |
Return a string to display as the clickable title for the
control. Overrides views_plugin_exposed_form:: |