public function ContentEntity::submitConfigurationForm in Search API 8
Form submission handler.
Parameters
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 PluginFormTrait::submitConfigurationForm
See also
\Drupal\Core\Plugin\PluginFormInterface::submitConfigurationForm()
File
- src/
Plugin/ search_api/ datasource/ ContentEntity.php, line 645
Class
- ContentEntity
- Represents a datasource which exposes the content entities.
Namespace
Drupal\search_api\Plugin\search_api\datasourceCode
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
// Filter out empty checkboxes.
foreach ([
'bundles',
'languages',
] as $key) {
if ($form_state
->hasValue($key)) {
$parents = [
$key,
'selected',
];
$value = $form_state
->getValue($parents, []);
$value = array_keys(array_filter($value));
$form_state
->setValue($parents, $value);
}
}
$this
->setConfiguration($form_state
->getValues());
}