From f226ae34074328d1181103caeb18be9691f44222 Mon Sep 17 00:00:00 2001 From: Dominic Tubach Date: Fri, 26 Apr 2024 15:29:27 +0200 Subject: [PATCH] Allow to display array controls inside `details` instead of `fieldset` so they are closeable --- src/Form/Control/ArrayArrayFactory.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Form/Control/ArrayArrayFactory.php b/src/Form/Control/ArrayArrayFactory.php index bf2eb27..b4fa54d 100644 --- a/src/Form/Control/ArrayArrayFactory.php +++ b/src/Form/Control/ArrayArrayFactory.php @@ -60,6 +60,11 @@ public function createFormArray(DefinitionInterface $definition, 'items' => [], ] + BasicFormPropertiesFactory::createBasicProperties($definition); + if (TRUE === $definition->getOptionsValue('closeable')) { + $form['#type'] = 'details'; + $form['#open'] = $definition->getOptionsValue('open', TRUE); + } + $propertyAccessor = FormStatePropertyAccessor::create($formState, $definition->getPropertyFormParents()); $numItems = $propertyAccessor->getProperty('numItems'); if (NULL === $numItems) {