Skip to content

Commit

Permalink
Merge pull request #60 from systopia/closeable-array-control
Browse files Browse the repository at this point in the history
Allow to display array controls inside `details` instead of `fieldset` so they are closeable
  • Loading branch information
dontub authored Apr 26, 2024
2 parents 327659f + f226ae3 commit 84b76fa
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 84b76fa

Please sign in to comment.