class views_composite_exposed_form_plugin in Views Hacks 7
Same name and namespace in other branches
- 6 views_composite_exposed_form/views_composite_exposed_form_plugin.inc \views_composite_exposed_form_plugin
@file Contains the composite exposed form plugin.
Hierarchy
- class \views_object
- class \views_plugin
Expanded class hierarchy of views_composite_exposed_form_plugin
1 string reference to 'views_composite_exposed_form_plugin'
- views_composite_exposed_form_views_plugins in views_composite_exposed_form/
views_composite_exposed_form.views.inc - Implementation of hook_views_plugins()
File
- views_composite_exposed_form/
views_composite_exposed_form_plugin.inc, line 7 - Contains the composite exposed form plugin.
View source
class views_composite_exposed_form_plugin extends views_plugin_exposed_form {
var $plugins = array();
function init(&$view, &$display, $options = array()) {
parent::init($view, $display, $options);
// Instantiate each of our contained plugins, just like views_plugin_display does.
foreach ($this->options['plugins'] as $name) {
$plugin = views_get_plugin('exposed_form', $name);
if (empty($plugin)) {
continue;
}
$options = isset($this->options[$name]) ? $this->options[$name] : array();
$options += array_intersect_key($this->options, parent::option_definition());
$plugin
->init($view, $display, $options);
$this->plugins[$name] = $plugin;
}
}
function summary_title() {
$plugins = array_intersect_key(views_fetch_plugin_names('exposed_form'), array_flip($this->options['plugins']));
if (empty($plugins)) {
$plugins[] = t('(none)');
}
return t('Composite: !plugins', array(
'!plugins' => implode(', ', $plugins),
));
}
function option_definition() {
views_include('admin');
$options = $parent_options = parent::option_definition();
$options['plugins'] = array(
'default' => array(),
);
foreach (array_keys(views_fetch_plugin_names('exposed_form')) as $name) {
if ($name == 'composite') {
continue;
}
$plugin = views_get_plugin('exposed_form', $name);
$options[$name] = $plugin
->option_definition();
$options[$name] = array_diff_key($options[$name], $parent_options);
}
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$parent_form = $form;
$options = views_fetch_plugin_names('exposed_form');
unset($options['composite']);
$form['plugins'] = array(
'#type' => 'checkboxes',
'#title' => t('Plugins'),
'#options' => $options,
'#default_value' => $this->options['plugins'],
'#description' => t('When you choose new plugins, please click "Update" then edit again to select the new plugin settings.'),
);
foreach ($this->options['plugins'] as $name) {
if (empty($name)) {
continue;
}
$form[$name] = array(
'#type' => 'fieldset',
'#title' => $options[$name],
'#tree' => TRUE,
);
$this->plugins[$name]
->options_form($form[$name], $form_state);
$form[$name] = array_diff_key($form[$name], $parent_form);
}
}
function options_validate(&$form, &$form_state) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->options_validate($form[$name], $form_state);
}
}
function options_submit(&$form, &$form_state) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->options_submit($form[$name], $form_state);
}
}
function exposed_form_alter(&$form, &$form_state) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->exposed_form_alter($form, $form_state);
}
}
function exposed_form_validate(&$form, &$form_state) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->exposed_form_validate($form, $form_state);
}
}
function exposed_form_submit(&$form, &$form_state, &$exclude) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->exposed_form_submit($form, $form_state, $exclude);
}
}
function pre_render($values) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->pre_render($values);
}
}
function post_render(&$output) {
foreach ($this->plugins as $name => $plugin) {
$plugin
->post_render($output);
}
}
function pre_execute() {
foreach ($this->plugins as $name => $plugin) {
$plugin
->pre_execute();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
views_composite_exposed_form_plugin:: |
property | |||
views_composite_exposed_form_plugin:: |
function |
Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
This function is executed when exposed form is submited. Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Initialize the plugin. Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Provide a form to edit options for this plugin. Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Handle any special handling on the validate form. Overrides views_plugin:: |
||
views_composite_exposed_form_plugin:: |
function |
Validate the options form. Overrides views_plugin:: |
||
views_composite_exposed_form_plugin:: |
function |
Information about options for all kinds of purposes will be held here. Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Overrides views_plugin_exposed_form:: |
||
views_composite_exposed_form_plugin:: |
function |
Returns the summary of the settings in the display. Overrides views_plugin:: |
||
views_object:: |
public | property | Handler's definition. | |
views_object:: |
public | property | Except for displays, options for the object will be held here. | 1 |
views_object:: |
function | Collect this handler's option definition and alter them, ready for use. | ||
views_object:: |
public | function | Views handlers use a special construct function. | 4 |
views_object:: |
public | function | Destructor. | 2 |
views_object:: |
public | function | 1 | |
views_object:: |
public | function | ||
views_object:: |
public | function | Always exports the option, regardless of the default value. | |
views_object:: |
public | function | Set default options on this object. | 1 |
views_object:: |
public | function | Set default options. | |
views_object:: |
public | function | Let the handler know what its full definition is. | |
views_object:: |
public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
views_object:: |
public | function | Unpack a single option definition. | |
views_object:: |
public | function | Unpacks each handler to store translatable texts. | |
views_object:: |
public | function | ||
views_plugin:: |
public | property | The current used views display. | |
views_plugin:: |
public | property | The plugin name of this plugin, for example table or full. | |
views_plugin:: |
public | property | The plugin type of this plugin, for example style or query. | |
views_plugin:: |
public | property |
The top object of a view. Overrides views_object:: |
1 |
views_plugin:: |
public | function | Provide a list of additional theme functions for the theme info page. | |
views_plugin:: |
public | function | Return the human readable name of the display. | |
views_plugin:: |
public | function | Provide a full list of possible theme templates used by this style. | |
views_plugin:: |
public | function | Validate that the plugin is correct and can be saved. | 3 |
views_plugin_exposed_form:: |
public | function | ||
views_plugin_exposed_form:: |
public | function |
Add anything to the query that we might need to. Overrides views_plugin:: |
1 |
views_plugin_exposed_form:: |
public | function | Render the exposed filter form. | |
views_plugin_exposed_form:: |
public | function |