hello,
I want to create a page for publications, so I created a PubHolder, PubPage and Publication classes as the following:
PubHolder.php
<?php
class PubHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $has_many = array(
);
static $icon = "ea/images/treeicons/books";
static $allowed_children = array('PubPage');
}
class PubHolder_Controller extends Page_Controller {
}
PubPage.php :
<?php
class PubPage extends Page
{
static $has_many = array (
'Publications' => 'Publication'
);
static $icon = "ea/images/treeicons/book-type";
public function getCMSFields()
{
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'Publications', // Source name
'Publication', // Source class
'photo', // File name on DataObject
array(
'Titre' => 'Titre',
'Auteur' => 'Auteur',
'Editeur' => 'Editeur'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
// If undefined, all types are allowed. Pass with or without a leading "."
$manager->setAllowedFileTypes(array('jpg','gif','png'));
// Label for the upload button in the popup
$manager->setBrowseButtonText( _t('PubPage.UPLOADONLY', 'Photo (jpg, gif ou png)'));
// In grid view, what field will appear underneath the icon. If left out, it defaults to the file title.
$manager->setGridLabelField('Titre');
// Plural form of the objects being managed. Used on the "Add" button.
// If left out, this defaults to [MyObjectName]s
$manager->setPluralTitle(_t('PubPage.UPLOADBUTTON', 'Publications'));
$f->addFieldToTab("Root.Content.Publications", $manager);
return $f;
}
}
class PubPage_Controller extends Page_Controller
{
}
Publication.php :
<?php
class Publication extends DataObject
{
static $db = array (
'Titre' => 'Text',
'Auteur' => 'Text',
'Pages' => 'Text',
'Version' => 'Text',
'Editeur' => 'Text',
'Description' => 'Text'
);
static $has_one = array (
'Photo' => 'Image',
'PubPage' => 'PubPage'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Titre'),
new TextField('Auteur'),
new TextField('Pages'),
new TextField('Version'),
new TextField('Editeur'),
new TextareaField('Description'),
new FileIFrameField('Photo')
);
}
}
?>
I get this error in the admin cms whenever I create a PubPage!
any help? thanks