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.

Data Model Questions /

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

treedropdownfield problem

Go to End



Community Member, 3 Posts

28 May 2014 at 6:31am

Hello world!
I'm quite beginner in SilverStripe so apologies for every silly question :)
Sittuation looks like this:
I have a class called Component which extends Page class. Component needs to have a link to different internal page. According to all information provided by uncle Google and search on forum I should use treedropdownfield as a extention to CMS Field.
Here is my code:

class Component extends Page {

	static $description = 'New component of the page';
	public static $db = array(
		'Subtitle' => 'Varchar(255)'		

	public static $has_one = array(
		'LinkedPage' => 'SiteTree'
	public static $defaults = array(
		'ShowInMenus' => false
	public function getCMSFields(){

		$fields = parent::getCMSFields();
		$fields->addFieldToTab('Root.Extra', new TextField('Subtitle','Subtitle'));
		$fields->addFiledToTab('Root.Extra', new TreeDropdownField('LinkedPage', 'Link', 'SiteTree'));
		return $fields;
class component_Controller extends Page_Controller {

	public function init() {

/dev/build gives correct output, site is displayed properly but ... When I'm trying to open page (Component page type) via CMS for editing all what can I see is a blank screen.
So my question is... what I'm doing wrong?

And funny part of my post: