Skip to content

Commit

Permalink
Allow to display array controls inside details instead of `fieldset…
Browse files Browse the repository at this point in the history
…` so they are closeable
  • Loading branch information
Dominic Tubach committed Apr 26, 2024
1 parent 327659f commit f226ae3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Form/Control/ArrayArrayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f226ae3

Please sign in to comment.