5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1524 Views |
-
TreeDropdownField - how to show subselect of SiteTree

27 May 2009 at 8:03pm Last edited: 27 May 2009 10:11pm
Hi there I'm trying to emulate serveral blocks of same types which can be included in serveral Pages unrelated from their hirachy.
I did the Following. Building a FolderObject (ElementsFolder) which inherited from SiteTree and an ElementObject (Element) which inherited from ElementsFolder. I positioned ElementsFolder in root without being seen in Search and Navigation. In the ElementsFolder I put serveral ElemtObjects. In my case the ElementObjects hold each a different set of 4 Pictures. Now instead of selecting all four pictures for each visible Page in the Sitetree, I can just select the preferred Pictureset from TreeDropDown. I'm still working on the way to clever extract the objects from the linked ElementObject, but thats not the Problem. I still have nice Ideas and will offer this as a Module when its running.
My Problem ist, that I want to stritp down the TreeDropdown to only show the Subtree with the ElementsFolder and Element Objects. I tried the following, but I always get the full sitetree:
class SomePage extends Page { // Redirector
public static $db = array(
);public static $has_one = array(
'LinkToElement' => 'ElementsFolder'
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TreeDropdownField("LinkToElementID", "Take Element from:", "ElementsFolder"));
return $fields;
}
}class SomePage_Controller extends Page_Controller {
}Anyone with any Ideas?
-
Re: TreeDropdownField - how to show subselect of SiteTree

3 June 2009 at 9:48pm Last edited: 3 June 2009 9:52pm
Hi there, I still found no solution for my Problem. Is there a way, to just include a subpart of the Sitetree into TreeDropdownField and not the full SiteTree?
If Sitetree looks the following
ROOT
__|- Main 1
__|__|- Sub1
__|__|- Sub2
__|- Main 2
__|__|- Sub1
__|__|- Sub2
__|- Main 3
_____|- Sub1
_____|- Sub2
I dont want to see all Main and Sub Pages in the Dropdown, I just want maybe The Subpages untder Main3 to be displayed in TreeDropdownField.
| 1524 Views | ||
|
Page:
1
|
Go to Top |

