public function SearchApiStandard::validateOptionsForm in Search API 8
Validate the options form.
Overrides ArgumentPluginBase::validateOptionsForm
File
- src/
Plugin/ views/ argument/ SearchApiStandard.php, line 93
Class
- SearchApiStandard
- Defines a contextual filter for applying Search API conditions.
Namespace
Drupal\search_api\Plugin\views\argumentCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
$option_values =& $form_state
->getValue('options');
if (empty($option_values)) {
return;
}
// Let the plugins do validation.
if (!empty($option_values['default_argument_type'])) {
$default_id = $option_values['default_argument_type'];
$plugin = $this
->getPlugin('argument_default', $default_id);
if ($plugin) {
$plugin
->validateOptionsForm($form['argument_default'][$default_id], $form_state, $option_values['argument_default'][$default_id]);
}
}
if (!empty($option_values['validate']['type'])) {
$sanitized_id = $option_values['validate']['type'];
// Correct ID for js sanitized version.
$validate_id = static::decodeValidatorId($sanitized_id);
$plugin = $this
->getPlugin('argument_validator', $validate_id);
if ($plugin) {
$plugin
->validateOptionsForm($form['validate']['options'][$sanitized_id], $form_state, $option_values['validate']['options'][$sanitized_id]);
}
}
}