Hello
at the moment i try to understand the whole dataobject-thing. my goal is to set some images with a caption and a redirect to different pages. the templaterendering should used on the homepage by a jqery-imageslider (orbit). do i have to use FileIFrameField on a getCMSFields function? or getCMSFields_forPopup. I need to bind the description and the redirect to the CostumImage.
My code for the dataobject so far.
<?php
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(){
return new FieldSet(
new FileIFrameField('SliderImage')
);
}
}
in HomePage i've got
public static $has_many = array(
'CustomImages' => 'CustomImage',
);
function getCMSFields() {
$fields = parent::getCMSFields();
//SliderImages
$images = new ImageDataObjectManager(
$this,
'CustomImages',
'CustomImage',
'SliderImage'
);
return $fields;
}
}
Is there a good tutorial about the FileIFrameField or HasManyComplexTableField. Thanks for your help.
Pipifix