Skip to content

Commit

Permalink
Allow rules for array controls, too
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Tubach committed Sep 3, 2024
1 parent b8f4067 commit 8c68880
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Form/Control/Util/BasicFormPropertiesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public static function createBasicProperties(ControlDefinition $definition): arr
$form['#attributes'] = ['placeholder' => $definition->getOptionsValue('placeholder')];
}

if (NULL !== $definition->getRule()) {
$statesArrayFactory = new StatesArrayFactory();
$form['#states'] = $statesArrayFactory->createStatesArray($definition->getRule());
}

// Custom option to hide labels, so they are not shown in the form by
// default, but can be used in validation errors.
if (TRUE === $definition->getOptionsValue('hideLabel')) {
Expand Down Expand Up @@ -103,11 +108,6 @@ public static function createFieldProperties(ControlDefinition $definition, Form
];
}

if (NULL !== $definition->getRule()) {
$statesArrayFactory = new StatesArrayFactory();
$form['#states'] = $statesArrayFactory->createStatesArray($definition->getRule());
}

return array_merge(static::createBasicProperties($definition), $form);
}

Expand Down

0 comments on commit 8c68880

Please sign in to comment.