diff --git a/src/Extensions/FileFormFactoryTaxonomyExtension.php b/src/Extensions/FileFormFactoryTaxonomyExtension.php index ce2f1d7..54a60b5 100644 --- a/src/Extensions/FileFormFactoryTaxonomyExtension.php +++ b/src/Extensions/FileFormFactoryTaxonomyExtension.php @@ -38,11 +38,8 @@ public function updateFormFields(FieldList $fields, $controller, $formName, $con $record = $context['Record']; if (!is_a($record, Folder::class)) { - - // Avoid using $fields->findOrMakeTab() so the tab "Tags" is added right after the first tab "Details" - $editorTabSet = $fields->fieldByName('Editor'); - $tagsTab = Tab::create('Tags', _t(self::class . '.TagsTabTitle', 'Tags')); - $editorTabSet->insertAfter('Details', $tagsTab); + if ($formName === 'fileEditForm') { + } $tags = TreeMultiselectField::create( 'Tags', @@ -60,10 +57,19 @@ public function updateFormFields(FieldList $fields, $controller, $formName, $con 'Open \'All taxonomies\' overview' ); - $fields->addFieldsToTab('Editor.Tags', [ - $tags, - $taxonomiesOverviewLink, - ]); + // list of fields that can be used both for the edit form as well as the history view + $atFormFields = [$tags, $taxonomiesOverviewLink]; + + if ($formName === 'fileEditForm') { + // Avoid using $fields->findOrMakeTab() so the tab "Tags" is added right after the first tab "Details" + $editorTabSet = $fields->fieldByName('Editor'); + $tagsTab = Tab::create('Tags', _t(self::class . '.TagsTabTitle', 'Tags')); + $editorTabSet->insertAfter('Details', $tagsTab); + + $tagsTab->getChildren()->merge($atFormFields); + } else { + $fields->merge($atFormFields); + } } } }