function views_plugin_display::options_submit in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 6.3 plugins/views_plugin_display.inc \views_plugin_display::options_submit()
- 7.3 plugins/views_plugin_display.inc \views_plugin_display::options_submit()
Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
Overrides views_plugin::options_submit
3 calls to views_plugin_display::options_submit()
- views_plugin_display_attachment::options_submit in plugins/
views_plugin_display_attachment.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
- views_plugin_display_block::options_submit in plugins/
views_plugin_display_block.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
- views_plugin_display_page::options_submit in plugins/
views_plugin_display_page.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
3 methods override views_plugin_display::options_submit()
- views_plugin_display_attachment::options_submit in plugins/
views_plugin_display_attachment.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
- views_plugin_display_block::options_submit in plugins/
views_plugin_display_block.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
- views_plugin_display_page::options_submit in plugins/
views_plugin_display_page.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
File
- plugins/
views_plugin_display.inc, line 1518 - Contains the base display plugin.
Class
- views_plugin_display
- The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.
Code
function options_submit(&$form, &$form_state) {
// Not sure I like this being here, but it seems (?) like a logical place.
$cache_plugin = $this
->get_cache_plugin();
if ($cache_plugin) {
$cache_plugin
->cache_flush();
}
$section = $form_state['section'];
switch ($section) {
case 'display_title':
$this->display->display_title = $form_state['values']['display_title'];
break;
case 'access':
$access = $this
->get_option('access');
if ($access['type'] != $form_state['values']['access']['type']) {
$plugin = views_get_plugin('access', $form_state['values']['access']['type']);
if ($plugin) {
$access = array(
'type' => $form_state['values']['access']['type'],
);
$plugin
->option_defaults($access);
$this
->set_option('access', $access);
if (!empty($plugin->definition['uses options'])) {
views_ui_add_form_to_stack('display', $this->view, $this->display->id, array(
'access_options',
));
}
}
}
break;
case 'access_options':
$plugin = views_get_plugin('access', $form_state['values'][$section]['type']);
if ($plugin) {
$plugin
->options_submit($form['access_options'], $form_state);
$this
->set_option('access', $form_state['values'][$section]);
}
break;
case 'cache':
$cache = $this
->get_option('cache');
if ($cache['type'] != $form_state['values']['cache']['type']) {
$plugin = views_get_plugin('cache', $form_state['values']['cache']['type']);
if ($plugin) {
$cache = array(
'type' => $form_state['values']['cache']['type'],
);
$plugin
->option_defaults($cache);
$this
->set_option('cache', $cache);
if (!empty($plugin->definition['uses options'])) {
views_ui_add_form_to_stack('display', $this->view, $this->display->id, array(
'cache_options',
));
}
}
}
break;
case 'cache_options':
$plugin = views_get_plugin('cache', $form_state['values'][$section]['type']);
if ($plugin) {
$plugin
->options_submit($form['cache_options'], $form_state);
$this
->set_option('cache', $form_state['values'][$section]);
}
break;
case 'title':
case 'css_class':
case 'link_display':
$this
->set_option($section, $form_state['values'][$section]);
break;
case 'use_ajax':
$this
->set_option($section, (bool) $form_state['values'][$section]);
break;
case 'use_pager':
$this
->set_option($section, $form_state['values'][$section]);
$this
->set_option('pager_element', intval($form_state['values']['pager_element']));
break;
case 'items_per_page':
$this
->set_option($section, intval($form_state['values'][$section]));
$this
->set_option('offset', intval($form_state['values']['offset']));
break;
case 'use_more':
$this
->set_option($section, intval($form_state['values'][$section]));
$this
->set_option('use_more_always', intval($form_state['values']['use_more_always']));
$this
->set_option('use_more_text', $form_state['values']['use_more_text']);
case 'distinct':
$this
->set_option($section, $form_state['values'][$section]);
break;
case 'row_plugin':
// This if prevents resetting options to default if they don't change
// the plugin.
if ($this
->get_option($section) != $form_state['values'][$section]) {
$plugin = views_get_plugin('row', $form_state['values'][$section]);
if ($plugin) {
$this
->set_option($section, $form_state['values'][$section]);
$this
->set_option('row_options', array());
// send ajax form to options page if we use it.
if (!empty($plugin->definition['uses options'])) {
views_ui_add_form_to_stack('display', $this->view, $this->display->id, array(
'row_options',
));
}
}
}
break;
case 'style_plugin':
// This if prevents resetting options to default if they don't change
// the plugin.
if ($this
->get_option($section) != $form_state['values'][$section]) {
$plugin = views_get_plugin('style', $form_state['values'][$section]);
if ($plugin) {
$this
->set_option($section, $form_state['values'][$section]);
$this
->set_option('style_options', array());
// send ajax form to options page if we use it.
if (!empty($plugin->definition['uses options'])) {
views_ui_add_form_to_stack('display', $this->view, $this->display->id, array(
'style_options',
));
}
}
}
break;
case 'style_options':
$style = TRUE;
case 'row_options':
// if row, $style will be empty.
$plugin = $this
->get_plugin(empty($style) ? 'row' : 'style');
if ($plugin) {
$plugin
->options_submit($form[$section], $form_state);
}
$this
->set_option($section, $form_state['values'][$section]);
break;
case 'header':
case 'footer':
case 'empty':
$this
->set_option($section, $form_state['values'][$section]);
$this
->set_option($section . '_format', $form_state['values'][$section . '_format']);
if ($section != 'empty') {
$this
->set_option($section . '_empty', $form_state['values'][$section . '_empty']);
}
break;
case 'exposed_block':
$this
->set_option($section, (bool) $form_state['values'][$section]);
break;
}
}