function 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 114

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.