Skip to content

Commit

Permalink
bug #37276 [Form] Fixed block prefixes hierarchy of the CollectionTyp…
Browse files Browse the repository at this point in the history
…e (yceruto)

This PR was merged into the 5.1 branch.

Discussion
----------

[Form] Fixed block prefixes hierarchy of the CollectionType

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37024
| License       | MIT
| Doc PR        | -

/cc @HeahDude

Commits
-------

a8f2c60 fixed block prefixes hierarchy of the CollectionType
  • Loading branch information
fabpot committed Jun 14, 2020
2 parents a89cc6b + a8f2c60 commit ccd9c1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -72,7 +72,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
*/
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 Down
Expand Up @@ -415,8 +415,8 @@ public function testEntriesBlockPrefixes()

$expectedBlockPrefixes = [
'form',
'text',
'collection_entry',
'text',
'_fields_entry',
];

Expand All @@ -436,8 +436,8 @@ public function testEntriesBlockPrefixesWithCustomBlockPrefix()
$this->assertCount(1, $collectionView);
$this->assertSame([
'form',
'text',
'collection_entry',
'text',
'field',
'_fields_entry',
], $collectionView[0]->vars['block_prefixes']);
Expand All @@ -454,8 +454,8 @@ public function testEntriesBlockPrefixesWithCustomBlockPrefixedType()
$this->assertCount(1, $collectionView);
$this->assertSame([
'form',
'block_prefixed_foo_text',
'collection_entry',
'block_prefixed_foo_text',
'foo',
'_fields_entry',
], $collectionView[0]->vars['block_prefixes']);
Expand Down

0 comments on commit ccd9c1f

Please sign in to comment.