Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

getCMSFields


Reply

3 Posts   1458 Views

Avatar
mattclegg

23 July 2010 at 10:24am (Last edited: 23 July 2010 10:24am), Community Member, 56 Posts

Hello Silverstripe Community,

Ok, I have tried debugging this problem although I know its probably something silly. I want to extend (forum) module so I can customise it and easily keep uptodate from SVN. I have something like;

_config.php

Object::add_extension('Forum', 'ForumExtender');

ForumExtender.php

class ForumExtender extends DataObjectDecorator {
   function updateCMSFields(&$fields) {
      $fields->removeFieldFromTab("Root.Content","Moderators");
      Debug::show('Hello World!');
   }
}

I know the function is running because of the debug message, but the FieldSet is not being updated. I presume its running in the wrong order? Is there anything I can do to override this? Or should I be doing this a different way?

Avatar
TotalNet

23 July 2010 at 10:39pm Community Member, 181 Posts

It's likely the tabname is incomplete, try "Root.Content.Main" instead.

If in doubt, check the corresponding addFieldToTab in forum.php to check it matches.

Avatar
mattclegg

23 July 2010 at 10:51pm (Last edited: 23 July 2010 10:51pm), Community Member, 56 Posts

Ah, well spotted. However I dont think it is a typo issue as changing it didn't work, and what I'm actually trying to do is add;

$fields->addFieldToTab("Root.Access", new TreeDropdownField("ForumPendingGroupID", "Group"));


with the same principle of the code above.