// 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
);
} // Don't store the 'target_bundles_update' button value into the field
// config settings.
$form_state->
unsetValue(['settings', 'handler_settings', 'target_bundles_update'
]);
} /**
* Form element validation handler; Filters the #value property of an element.
*/
public static function elementValidateFilter(&
$element, FormStateInterface
$form_state) { $element['#value'
] =
array_filter($element['#value'
]);
$form_state->
setValueForElement($element,
$element['#value'
]);
} /**
* {@inheritdoc}
*/