Jump to:

1136 Posts in 1984 Topics by 403 members

Upgrading SilverStripe

SilverStripe Forums » Upgrading SilverStripe » Removing stuff from backend

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1446 Views
  • yurigoul
    Avatar
    Community Member
    202 Posts

    Removing stuff from backend Link to this post

    With previous versions $fields->removeFieldFromTab('Root', 'Access'); removed the settings tab (used to be 'Access') from the interface. And some other remove tricks do also not work anymore.

    Anybody found out how this can be done now?

    Thnx!

  • Willr
    Avatar
    Forum Moderator
    5464 Posts

    Re: Removing stuff from backend Link to this post

    The tab names have been changed but the functions still exist

    removeByName($name)
    removeFieldFromTab($tab, $field)
    removeFieldsFromTab($tab, $fields)

    If you don't know a tab name, check the SiteTree.php getCMSFields() to see what the identifier is.

  • yurigoul
    Avatar
    Community Member
    202 Posts

    Re: Removing stuff from backend Link to this post

    With getSettingsFields() instead of getCMSFields() you can remove the contents of the tab, but you can not remove the tab itself.

    function getSettingsFields() {
    $fields = parent::getSettingsFields();

    $fields->removeFieldFromTab("Root", "Settings");

    return $fields;
    }

    This results in a tab that leads to an empty page.

    I managed to remove it eventually by changing CMSMain_Content.ss since that tab is hard coded there, by putting <% if $CurrentMember.inGroup(2) %> ... <% end_if %> around it (where 2 is the admin group).

  • camfindlay
    Avatar
    Forum Moderator
    82 Posts

    Re: Removing stuff from backend Link to this post

    Hey guys, I am having a similar issue...

    I have a DataObj called "Product" which has a many_many to "Tag".

    I have just replaced the default "Tag" tab with a listboxfield and placed it alongside the other product information in the Root.Main however my Root.Tags tab remains in the interface as an empty panel.

    assume this is a cms issue perhaps it should be logged in the tracker?

  • LinseyM
    Avatar
    Community Member
    99 Posts

    Re: Removing stuff from backend Link to this post

    Post hijack coming up
    Any feedback on how to remove/hide a tab from the CMS?

    I have an admin tab created in Page.php, but i don't want it to appear under Properties.php pages, so I put in the following code:

          $fields->removeFieldFromTab("Root.Admin", "ShowInDropDown");
          $fields->removeFieldFromTab("Root.Admin", "ShowListings");
          $fields->removeFieldFromTab("Root.Admin", "CustomBanner");
          $fields->removeFieldFromTab("Root.Admin", "CategoryImage");

    This removed the fields, but the empty tab remains... how do I make the tab itself go away? I tried this (to no effect, understandably!)

          $fields->removeByName("Root.Admin");

  • kinglozzer
    Avatar
    Community Member
    138 Posts

    Re: Removing stuff from backend Link to this post

    Linsey, not 100% sure on this one but try:

    $fields->removeByName("Admin");

  • yurigoul
    Avatar
    Community Member
    202 Posts

    Re: Removing stuff from backend Link to this post

    Did you try it with editing CMSMain_Content.ss ?

  • LinseyM
    Avatar
    Community Member
    99 Posts

    Re: Removing stuff from backend Link to this post

    $fields->removeByName("Admin");

    That did it.... cheers!

    1446 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.