function views_ui_add_form_validate in Views (for Drupal 7) 6.3
Same name and namespace in other branches
- 6.2 includes/admin.inc \views_ui_add_form_validate()
Validate the add view form.
1 string reference to 'views_ui_add_form_validate'
- views_ui_add_form in includes/
admin.inc - Form constructor callback to create the views Add Form, phase 1.
File
Code
function views_ui_add_form_validate($form, &$form_state) {
$name = $form_state['values']['name'];
// View name must be alphanumeric or underscores, no other punctuation.
if (preg_match('/[^a-zA-Z0-9_]/', $name) || is_numeric($name)) {
form_error($form['name'], t('View name must be alphanumeric or underscores only, but cannot be numeric.'));
}
// View name must already exist.
$view = views_get_view($form_state['values']['name']);
if ($view && $view->type != t('Default')) {
form_error($form['name'], t('You must use a unique name for this view.'));
}
}