public function DefaultSelection::validateConfigurationForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::validateConfigurationForm()
Form validation 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 PluginFormInterface::validateConfigurationForm
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ EntityReferenceSelection/ DefaultSelection.php, line 216 - Contains \Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection.
Class
- DefaultSelection
- Default plugin implementation of the Entity Reference Selection plugin.
Namespace
Drupal\Core\Entity\Plugin\EntityReferenceSelectionCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
// If no checkboxes were checked for 'target_bundles', store NULL ("all
// bundles are referenceable") rather than empty array ("no bundle is
// referenceable" - typically happens when all referenceable bundles have
// been deleted).
if ($form_state
->getValue([
'settings',
'handler_settings',
'target_bundles',
]) === []) {
$form_state
->setValue([
'settings',
'handler_settings',
'target_bundles',
], NULL);
}
}