I have got FileDataObjectManager working.. and as the tutorial says
"
The ImageDataObjectManager takes the same arguments and configuration as a FileDataObjectManager. The only difference is that its only allowed file classes are Image or subclasses thereof.
"
so i repeated exactly what i did for the FileDataObjectManager
and changed to this
<?php
class ResourceImagesPage extends Page
{
static $has_many = array (
'ResourceImages' => 'ResourceImage'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'ResourceImages', // Source name
'ResourceImage', // Source class
'Attachment', // File name on DataObject
array(
'Name' => 'Name',
'Description' => 'Description',
'Category' => 'Category'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.ResourceImages",$manager);
return $f;
}
}
?>
and this
<?php
class ResourceImages extends DataObject
{
static $db = array (
'Name' => 'Text',
'Description' => 'Text',
'Category' => "Enum('Industry, Finance, Education')"
);
static $has_one = array (
'Attachment' => 'image',
'ResourceImagesPage' => 'ResourceImagesPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextareaField('Description'),
new DropdownField('Category','Category', singleton('Resource')->dbObject('Category')->enumValues()),
new FileIFrameField('Attachment')
);
}
}
?>
can anyone tell me why it does not work?
i create page and it goes wrong.