Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » GridField shows related page. Why?

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

Page: 1
Go to End
Author Topic: 486 Views
  • suntrop
    Avatar
    Community Member
    131 Posts

    GridField shows related page. Why? Link to this post

    I am developing my first SS3 website and implemented a GridField. It was pretty tough, since this new concept isn't documented well in my opinion.

    Anyway, I think it is working now, but why is there always a dropdown showing the current page? I didn't tell SS to show this field and I don't know how to remove it.

    For example …
    http://doc.silverstripe.org//src/framework_3.0/docs/en/tutorials/_images/tutorial5_addNew.jpg
    In chapter 5 of the SS tutorial the page "Developer Toolbar" has a GridField attached and when I edit an item at the bottom it shows the field "Project". Without any purpose. I can't even edit/change it.

    Is this a bug?

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: GridField shows related page. Why? Link to this post

    This is because the default getCMSFields() method includes fields for every relation on the DataObject, including the one that GridField manages. You can remove it by defining a getCMSFields() method on your DataObject that looks something like:

       public function getCMSFields() {
          $fields = parent::getCMSFields();
          $fields->removeByName('ProjectID');
          return $fields;
       }

  • suntrop
    Avatar
    Community Member
    131 Posts

    Re: GridField shows related page. Why? Link to this post

    Cool. Thanks for your reply. Works!

    486 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.