function views_element_validate_tags

Same name and namespace in other branches
  1. 10 core/modules/views/views.module \views_element_validate_tags()
  2. 9 core/modules/views/views.module \views_element_validate_tags()
  3. 8.9.x core/modules/views/views.module \views_element_validate_tags()
  4. main core/modules/views/views.module \views_element_validate_tags()

Validation callback for query tags.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. There is no replacement.

See also

https://www.drupal.org/node/3572594

File

core/modules/views/views.module, line 396

Code

function views_element_validate_tags($element, FormStateInterface $form_state) : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no replacement. See https://www.drupal.org/node/3572594', E_USER_DEPRECATED);
  $values = array_map('trim', explode(',', $element['#value']));
  foreach ($values as $value) {
    if (preg_match("/[^a-z_]/", $value)) {
      $form_state->setError($element, t('The query tags may only contain lower-case alphabetical characters and underscores.'));
      return;
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.