public function DataFieldRow::validateOptionsForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::validateOptionsForm()
Validate the options form.
Overrides RowPluginBase::validateOptionsForm
File
- core/
modules/ rest/ src/ Plugin/ views/ row/ DataFieldRow.php, line 122
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'));
}
}