Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
Do not call validateReferenceableEntities() with an empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
ol0lll authored Oct 22, 2020
1 parent 73def20 commit a41b1d7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ protected static function prepareFieldValues(array $values, array $element) {
/** @var \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface $handler */
$handler = \Drupal::service('plugin.manager.entity_reference_selection')->getInstance($handler_settings);

$options = static::getValidReferenceableEntities(array_keys(OptGroup::flattenOptions($element['#options'])), $handler_settings);
$options = empty($element['#options']) ? [] : static::getValidReferenceableEntities(array_keys(OptGroup::flattenOptions($element['#options'])), $handler_settings);
$items = [];
foreach ($values as $value) {
if (isset($options[$value])) {
Expand Down

0 comments on commit a41b1d7

Please sign in to comment.