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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

Setting $showInMenus to false - or is it readonly?

Go to End

4 Posts   3128 Views


Community Member, 12 Posts

2 September 2009 at 4:41pm

I would like to make sure that all pages created of a particular template type are not shown in menus. Is it possible to set this value from the Page_Controller and then remove the checkbox / make the checkbox disabled so that users cannot make this page visible in menus?


Community Member, 12 Posts

2 September 2009 at 5:06pm

Just to clarify - this is what I've got so far:

function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root.Behaviour', 'ShowInMenus')
return $fields;

which hides the field ok, but I can't seem to set the value to 0


Forum Moderator, 5523 Posts

2 September 2009 at 7:04pm

You can set the default value of the field using static $defaults. Then remove the field as you have done.

// on your custom page type
static $defaults = array(
'ShowInMenus' => 0


Community Member, 12 Posts

3 September 2009 at 9:24am

Perfect. Thank you.