public function CallbackFieldRow::validateOptionsForm in Search Autocomplete 8
Same name and namespace in other branches
- 2.x src/Plugin/views/row/CallbackFieldRow.php \Drupal\search_autocomplete\Plugin\views\row\CallbackFieldRow::validateOptionsForm()
Overrides \Drupal\views\Plugin\views\row\RowPluginBase::validateOptionsForm().
Overrides RowPluginBase::validateOptionsForm
File
- src/
Plugin/ views/ row/ CallbackFieldRow.php, line 133
Class
- CallbackFieldRow
- Plugin which displays fields as raw data.
Namespace
Drupal\search_autocomplete\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'));
}
}