Hi,
great ! Now I've got a tab in each paper edit-part in wich I can see all the staff I inputed in the staff part. But I can't select the one I want to set as authors.
Here's my code : Article.php
class Article extends Page {
static $db = array(
'Date1' => 'Date',
'Author1' => 'Text'
);
static $has_one = array(
'ImageArticle'=>'Image',
'FileArticle'=>'File'
);
static $many_many = array(
'Authors' => 'StaffPage'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date1'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new ImageField('ImageArticle'),'Content');
$fields->addFieldToTab('Root.Content.Main', new FileIFrameField('FileArticle'),'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author1'),'Content');
$tablefield = new HasManyComplexTableField(
$this,
'Authors',
'StaffPage'
);
$tablefield->setAddTitle( 'Authors' );
$fields->addFieldToTab( 'Root.Content.Authors', $tablefield );
return $fields;
}
}
class Article_Controller extends Page_Controller {
}
and I've just add the
static $belongs_many_many = array(
'Papers' => 'PaperPage'
);
to the staffPage.php