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.

Archive

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

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

TreeDropdownField showing Admin instead of Site Content


Reply

4 Posts   1700 Views

Avatar
RS26

5 December 2008 at 2:46am (Last edited: 5 December 2008 2:50am), Community Member, 11 Posts

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

5 December 2008 at 3:22am (Last edited: 5 December 2008 3:23am), 121 Posts

From memory I think it's like this:

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

Avatar
RS26

5 December 2008 at 3:42am Community Member, 11 Posts

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

Avatar
RS26

5 December 2008 at 4:32am (Last edited: 5 December 2008 5:22am), Community Member, 11 Posts

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