diff --git a/src/lib/Content/Form/Provider/GroupedContentFormFieldsProvider.php b/src/lib/Content/Form/Provider/GroupedContentFormFieldsProvider.php index 938034e1..f68b4c39 100644 --- a/src/lib/Content/Form/Provider/GroupedContentFormFieldsProvider.php +++ b/src/lib/Content/Form/Provider/GroupedContentFormFieldsProvider.php @@ -25,16 +25,13 @@ public function __construct(FieldsGroupsList $fieldsGroupsList) public function getGroupedFields(array $fieldsDataForm): array { - $fieldsGroups = $this->fieldsGroupsList->getGroups(); $groupedFields = []; foreach ($fieldsDataForm as $fieldForm) { /** @var \Ibexa\Contracts\ContentForms\Data\Content\FieldData $fieldData */ $fieldData = $fieldForm->getViewData(); $fieldGroupIdentifier = $this->fieldsGroupsList->getFieldGroup($fieldData->fieldDefinition); - $fieldGroupName = $fieldsGroups[$fieldGroupIdentifier] ?? $this->fieldsGroupsList->getDefaultGroup(); - - $groupedFields[$fieldGroupName][] = $fieldForm->getName(); + $groupedFields[$fieldGroupIdentifier][] = $fieldForm->getName(); } return $groupedFields; diff --git a/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php b/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php index 7ce00ada..f2ae600c 100644 --- a/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php +++ b/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php @@ -28,14 +28,6 @@ public function testGetGroupedFields(): void ->withConsecutive() ->willReturnOnConsecutiveCalls('group_1', 'group_2', 'group_2'); - $fieldsGroupsListMock - ->expects($this->once()) - ->method('getGroups') - ->willReturn([ - 'group_1' => 'Group 1', - 'group_2' => 'Group 2', - ]); - $subject = new GroupedContentFormFieldsProvider($fieldsGroupsListMock); $form1 = $this->getFormMockWithFieldData( @@ -56,10 +48,10 @@ public function testGetGroupedFields(): void $result = $subject->getGroupedFields([$form1, $form2, $form3]); $expected = [ - 'Group 1' => [ + 'group_1' => [ 0 => 'first_field', ], - 'Group 2' => [ + 'group_2' => [ 0 => 'second_field', 1 => 'third_field', ],