Skip to content

Commit

Permalink
ArrayArrayFactory: Set #limit_validation_errors to [] instead of …
Browse files Browse the repository at this point in the history
…`TRUE`

If `#limit_validation_errors` is not `FALSE` Drupal expects an array and
tries to iterate over it. Using `TRUE` results in a PHP warning.
  • Loading branch information
Dominic Tubach committed Jan 30, 2025
1 parent 521da17 commit b3056e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Form/Control/ArrayArrayFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function createFormArray(
'#disabled' => NULL !== $definition->getMinItems() && $numItems <= $definition->getMinItems(),
'#value' => $definition->getOptionsValue('removeButtonLabel', 'x'),
'#name' => $definition->getFullScope() . '_remove_' . $i,
'#limit_validation_errors' => TRUE,
'#limit_validation_errors' => [],
'#validate' => [ArrayCallbacks::class . '::removeItem'],
'#submit' => [],
'#ajax' => [
Expand All @@ -133,7 +133,7 @@ public function createFormArray(
'#type' => 'button',
'#disabled' => NULL !== $definition->getMaxItems() && $numItems >= $definition->getMaxItems(),
'#value' => $definition->getOptionsValue('addButtonLabel', '+'),
'#limit_validation_errors' => TRUE,
'#limit_validation_errors' => [],
'#validate' => [ArrayCallbacks::class . '::addItem'],
'#submit' => [],
'#ajax' => [
Expand Down

0 comments on commit b3056e2

Please sign in to comment.