You are here

public function DataFieldRow::validateAliasName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 114
Contains \Drupal\rest\Plugin\views\row\DataFieldRow.

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.'));
  }
}