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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

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

TreeDropdownField showing Admin instead of Site Content


Go to End


4 Posts   2723 Views

Avatar
RS26

Community Member, 11 Posts

5 December 2008 at 2:46am

Edited: 05/12/2008 2:50am

I am trying to create a drop down menu that displays the pages on my site... but when I use 'TreeDropdownField' it gives me a list of site admin ... not the pages.

Is there anything I'm doing wrong here?

static $has_one = array(
		'BoxTree1' => 'SiteTree'
   );

function getCMSFields() {
		$fields->addFieldToTab('Root.Content.Box1', new TreeDropdownField('BoxTree1','More Link'), "SiteTree");	 
}

Avatar
jam13

121 Posts

5 December 2008 at 3:22am

Edited: 05/12/2008 3:23am

From memory I think it's like this:

$fields->addFieldToTab('Root.Content.Box1', new TreeDropdownField('BoxTree1ID', 'More Link', 'SiteTree'));

Avatar
RS26

Community Member, 11 Posts

5 December 2008 at 3:42am

Sweet! it worked. This was driving me mad. Thanks man!

Avatar
RS26

Community Member, 11 Posts

5 December 2008 at 4:32am

Edited: 05/12/2008 5:22am

Uh oh... now I have a new problem... how do I return the URL from a selection? It seems to be returning an ID.