function views_element_validate_tags in Views (for Drupal 7) 8.3
Same name and namespace in other branches
- 7.3 plugins/views_plugin_query_default.inc \views_element_validate_tags()
Validation callback for query tags.
1 string reference to 'views_element_validate_tags'
- Sql::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ query/ Sql.php - Add settings for the ui.
File
- ./
views.module, line 2208 - Primarily Drupal hooks and global API functions to manipulate views.
Code
function views_element_validate_tags($element, &$form_state) {
$values = array_map('trim', explode(',', $element['#value']));
foreach ($values as $value) {
if (preg_match("/[^a-z_]/", $value)) {
form_error($element, t('The query tags may only contain lower-case alphabetical characters and underscores.'));
return;
}
}
}