public function SiteNameProperty::validateConfigurationForm in Search API Field Map 8.2
Validates a configuration form for a field based on this property.
Parameters
\Drupal\search_api\Item\FieldInterface $field: The field for which the configuration form is validated.
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.
Overrides ConfigurablePropertyBase::validateConfigurationForm
File
- src/
Plugin/ search_api/ processor/ Property/ SiteNameProperty.php, line 85
Class
- SiteNameProperty
- Defines a "site name" property.
Namespace
Drupal\search_api_field_map\Plugin\search_api\processor\PropertyCode
public function validateConfigurationForm(FieldInterface $field, array &$form, FormStateInterface $form_state) {
// Confirm that at least one field is populated.
if (!$form_state
->getValue([
'site_name_group',
'use_system_site_name',
]) && !strlen($form_state
->getValue([
'site_name_group',
'site_name',
]))) {
$form_state
->setError($form['site_name_group'], $this
->t('Please either select the option to use the system site name or enter a site name.'));
}
}