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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

SimpleTreeDropdownField makes Problems

Go to End

10 Posts   3723 Views


Community Member, 56 Posts

4 February 2012 at 5:10am

Hi, i've run in the same problem. my goal is to show some images with a redirect link on homepage.

my class:

class CustomImage extends DataObject 
	//db fields
 	static $db = array (
        'Description' => 'Varchar(100)',
	 * Our custom image class contains one image that is used on one page.
	public static $has_one = array (
		'SliderImage' => 'Image',
		'PageRedirect' => 'SiteTree'

	 * Popup for editing a single image.
	 * @return FieldSet The iframe for editing the image.
	public function getCMSFields_forPopup(){
		$fields = new FieldSet(
			new TextField('Description'),
			new SimpleTreeDropDownField('PageRedirectID','Bild verlinkt zu','SiteTree'),
			new FileIFrameField('SliderImage','Bild für den Slider', Null, Null, Null, 'Uploads/homepage-sliderbilder/')
		return $fields;

and my model:

class HomePage extends Page {
   static $db = array(
   		'HomeMainHeading' => 'Text',
   		'HomeSubHeading' => 'Text',
   		'HomeCol1' => 'HTMLText',
   		'HomeCol2' => 'HTMLText'
   	public static $has_many = array(
      	'CustomImages' => 'CustomImage',
   function getCMSFields() {
		$fields = parent::getCMSFields();
		$images = new ImageDataObjectManager(
        	$this, // Controller 
        	'CustomImages', // Source name 
        	'CustomImage', // Source class 
        	'SliderImage', // File name on DataObject 
            'Description' => 'Description' //,
           // 'PageRedirect' => 'PageRedirect'
         	), // Headings
         'getCMSFields_forPopup' // Detail fields
         // Filter clause
         // Sort clause
         // Join clause
		$fields->addFieldToTab('Root.Content.SliderBilder', $images);
		return $fields;

if i comment out the PageRedirect in the array there is an error (…the method 'fortemplate' does not exist on…). otherwise the SimpleTreeDropDownField is not shown in the popup. Whats wrong with this code?

Thanks for your help. Pipifix


Community Member, 56 Posts

11 February 2012 at 2:40am


I'm still searching a solution for that. So i will appreciate your help. If i change the the PageRedirect in PageRedirectID in the ImageDataObjectManager the dropdown is also not shown. Maybe someone can give me a tip or point me to the error?

Thanks Pipifix

Go to Top