function views_plugin_display::options_validate in Views (for Drupal 7) 6.3
Same name and namespace in other branches
- 6.2 plugins/views_plugin_display.inc \views_plugin_display::options_validate()
- 7.3 plugins/views_plugin_display.inc \views_plugin_display::options_validate()
Validate the options form.
Overrides views_plugin::options_validate
1 call to views_plugin_display::options_validate()
- views_plugin_display_page::options_validate in plugins/
views_plugin_display_page.inc - Validate the options form.
1 method overrides views_plugin_display::options_validate()
- views_plugin_display_page::options_validate in plugins/
views_plugin_display_page.inc - Validate the options form.
File
- plugins/
views_plugin_display.inc, line 1978 - 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_validate(&$form, &$form_state) {
switch ($form_state['section']) {
case 'display_title':
if (empty($form_state['values']['display_title'])) {
form_error($form['display_title'], t('Display title may not be empty.'));
}
break;
case 'css_class':
$css_class = $form_state['values']['css_class'];
if (preg_match('/[^a-zA-Z0-9- _]/', $css_class)) {
form_error($form['css_class'], t('CSS classes must be alphanumeric or dashes only.'));
}
break;
case 'display_id':
if ($form_state['values']['display_id']) {
if (preg_match('/[^a-z0-9_]/', $form_state['values']['display_id'])) {
form_error($form['display_id'], t('Display name must be letters, numbers, or underscores only.'));
}
foreach ($this->view->display as $id => $display) {
if ($id != $this->view->current_display && ($form_state['values']['display_id'] == $id || $form_state['values']['display_id'] == $display->new_id)) {
form_error($form['display_id'], t('Display id should be unique.'));
}
}
}
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_validate($form[$form_state['section']], $form_state);
}
break;
case 'access_options':
$plugin = $this
->get_plugin('access');
if ($plugin) {
$plugin
->options_validate($form['access_options'], $form_state);
}
break;
case 'query':
if ($this->view->query) {
$this->view->query
->options_validate($form['query'], $form_state);
}
break;
case 'cache_options':
$plugin = $this
->get_plugin('cache');
if ($plugin) {
$plugin
->options_validate($form['cache_options'], $form_state);
}
break;
case 'exposed_form_options':
$plugin = $this
->get_plugin('exposed_form');
if ($plugin) {
$plugin
->options_validate($form['exposed_form_options'], $form_state);
}
break;
case 'pager_options':
$plugin = $this
->get_plugin('pager');
if ($plugin) {
$plugin
->options_validate($form['pager_options'], $form_state);
}
break;
}
foreach ($this->extender as $extender) {
$extender
->options_validate($form, $form_state);
}
}