- Issue created by @Mschudders
- 🇧🇪Belgium Mschudders
Before:
if ($value) { $storage = \Drupal::entityTypeManager()->getStorage($entity_type); $entity = $storage->load($value); $form['override'][$block->getDerivativeId()][$type][$id]['value']['#default_value'] = $entity; }
After:
if ($value) { $storage = \Drupal::entityTypeManager()->getStorage($entity_type); $values = preg_split("/[\+,]+/", $value) ?: []; $default = $storage->loadMultiple($values); $form['override'][$block->getDerivativeId()][$type][$id]['value']['#default_value'] = $default; }
- 🇧🇪Belgium Mschudders
todo have to test mixing "+" and ",".
Right now tested "+" and "single values"
- 🇧🇪Belgium arwillame
I had some issues testing your proposition.
The form configuration do not allowed me to have multiple values in the "entity_autocomplete".So i created a patch that allow the user to add multiple entities using the "#tags" parameter.
I also add a check to only do that when the related view allow ultiple elements.Finally i made a little change in the execute method to be able to use the multiple values in the context filter itself.
Please feel free to comment my proposition.