SilverStripe displays redundant tabs

Whenever I make a connection $has_manyor $many_many, SilverStripe will create the corresponding tab in the top tab. I create GridFieldby assigning it to a variable and pasting it into the main tab. This works fine, but the Tiles tab still remains, although it is empty.

$fields->addFieldsToTab('Root.Main',
    [
        ... Other fields ...,
        $tiles
    ]
);

I tried $fields->removeByName('Tiles');but removes the tab and field. Is there a way to remove the top tab and save the field?

Main tab (grid tile at the bottom)

enter image description here

Tiles Tabs (empty)

enter image description here

+4
source share
1 answer

Remove the tab Tilesbefore adding a new one Tiles GridFieldto:

$fields->removeByName('Tiles');

$fields->addFieldsToTab('Root.Main',
    [
        ... Other fields ...,
        $tiles
    ]
);
+4
source

Source: https://habr.com/ru/post/1628223/


All Articles