function DataFieldRow::validateOptionsForm
Same name in other branches
- 9 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateOptionsForm()
- 8.9.x core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateOptionsForm()
- 11.x core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateOptionsForm()
Overrides RowPluginBase::validateOptionsForm
File
-
core/
modules/ rest/ src/ Plugin/ views/ row/ DataFieldRow.php, line 123
Class
- DataFieldRow
- Plugin which displays fields as raw data.
Namespace
Drupal\rest\Plugin\views\rowCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
// Collect an array of aliases to validate.
$aliases = static::extractFromOptionsArray('alias', $form_state->getValue([
'row_options',
'field_options',
]));
// If array filter returns empty, no values have been entered. Unique keys
// should only be validated if we have some.
if (($filtered = array_filter($aliases)) && array_unique($filtered) !== $filtered) {
$form_state->setErrorByName('aliases', $this->t('All field aliases must be unique'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.