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

Customizing the TreeMultiselectField in the CMS

Go to End



Community Member, 4 Posts

5 November 2010 at 4:41am

Edited: 05/11/2010 4:42am

In the admin I have as an option when you create a new item to let you choose which categories it belongs to through a TreeMultiselectField.

$treeMenu = new TreeMultiselectField('Categories', 'What categories does this belong in?', 'PortfolioCategory');

PortfolioCategory is a class that extends Page.

Now, when you click on the drop down to select a category, it just shows the entire site tree. Is there a way to customize it to say, only show Pages of type "PortfolioCategory"?

Also, is there a way to have an option in the drop down automatically selected by default? Ideally, when you click "Add New Item", the drop down is there and one of the options is already selected and cannot be unselected.