function Sql::elementValidateTags

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::elementValidateTags()

Validation callback for query tags.

@internal

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1916

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public static function elementValidateTags(array &$element, FormStateInterface $form_state) : void {
  $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.