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?