17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2040 Views |
-
Creating pages with default behaviours?

20 November 2007 at 7:12pm
Hi I was just wondering if it was possible to create default behaviours for new pages. I am creating some custom pages and I would like for them to have 'show in menu' and 'show in search' turned off by default when they're created.
-
Re: Creating pages with default behaviours?

20 November 2007 at 7:40pm Last edited: 20 November 2007 7:42pm
you can use $defaults array as a way of setting default values for a page type. Use it the same way as $db or $has_one eg in the Page class you can have
static $defaults = array(
'ProvideComments' => true
);so to hide search and menus you could have
static $defaults = array (
'ShowInMenus' = false,
'ShowInSearch' = false
);I think / hope thats the right names for the fields. More info on http://doc.silverstripe.com/doku.php?id=tutorial:2-extending-a-basic-site and http://doc.silverstripe.com/doku.php?id=datamodel
-
Re: Creating pages with default behaviours?

20 November 2007 at 10:04pm
Awesome thanks, I double checked the variable names in SiteTree.php and they seem correct so I anticipate that it will work a treat. Much appreciated.
| 2040 Views | ||
|
Page:
1
|
Go to Top |


