function DataFieldRow::validateAliasName

Same name in other branches
  1. 9 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateAliasName()
  2. 10 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateAliasName()
  3. 11.x core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateAliasName()

Form element validation handler for \Drupal\rest\Plugin\views\row\DataFieldRow::buildOptionsForm().

File

core/modules/rest/src/Plugin/views/row/DataFieldRow.php, line 113

Class

DataFieldRow
Plugin which displays fields as raw data.

Namespace

Drupal\rest\Plugin\views\row

Code

public function validateAliasName($element, FormStateInterface $form_state) {
    if (preg_match('@[^A-Za-z0-9_-]+@', $element['#value'])) {
        $form_state->setError($element, $this->t('The machine-readable name must contain only letters, numbers, dashes and underscores.'));
    }
}

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