Skip to content

Commit

Permalink
bug #3360 Fixed block prefixes order of the CollectionType (yceruto)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.0.x-dev branch.

Discussion
----------

Fixed block prefixes order of the CollectionType

Fixes #3357

Commits
-------

14f1198 Fixed block prefixes order of the CollectionType
  • Loading branch information
javiereguiluz committed Jun 22, 2020
2 parents 4538ec3 + 14f1198 commit 9781c31
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Form/Extension/CollectionTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CollectionTypeExtension extends AbstractTypeExtension
{
public function finishView(FormView $view, FormInterface $form, array $options)
{
$prefixOffset = -1;
$prefixOffset = -2;
// check if the entry type also defines a block prefix
/** @var FormInterface $entry */
foreach ($form as $entry) {
Expand All @@ -40,11 +40,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)

/** @var FormInterface $prototype */
if ($prototype = $form->getConfig()->getAttribute('prototype')) {
if ($view->vars['prototype']->vars['multipart']) {
$view->vars['multipart'] = true;
}

if ($prefixOffset > -2 && $prototype->getConfig()->getOption('block_prefix')) {
if ($prefixOffset > -3 && $prototype->getConfig()->getOption('block_prefix')) {
--$prefixOffset;
}

Expand Down

0 comments on commit 9781c31

Please sign in to comment.