10/10/2010 1:13am

PHP | Problem - ModelPage


class ModelPage extends ModelHolder {


public static $db = array(
//'Date' =>'Date',
//'Author' => 'Text'
);
// http://doc.silverstripe.org/data-types

public static $has_one = array(
//'MainImage' => 'Image'
);

public static $has_many = array (
//'PageImages' => 'PageImage'
);

public static $many_many = array(
'AccessoryPages' => 'AccessoryPage',
'ModelProperties' => 'ModelProperty'
);

// Set allowed child pagetypes of this pagetype
//static $allowed_children = array('Page');

public function getCMSFields() {
$fields = parent::getCMSFields();

// Adding custom fields to CMS
// http://doc.silverstripe.org/form-field-types

//$fields->addFieldToTab('Root.Content.Main', new DateField('Date'), 'Content');
//$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
//$fields->addFieldToTab("Root.Content.Images", new ImageField('MainImage'));
//$fields->addFieldToTab('Root.Content.Specials', new TreeMultiselectField( 'PageList', 'Side liste', 'SiteTree' ));


$accessoriesTablefield = new ManyManyComplexTableField(
$this,
'AccessoryPages',
'AccessoryPage',
array(
'Title' => 'Title'
),
'getCMSFields_forPopup'
);
$accessoriesTablefield->setAddTitle( 'an accessory' );

$fields->addFieldToTab( 'Root.Content.Accessories', $accessoriesTablefield );


$propertiesTablefield = new ManyManyComplexTableField(
$this,
'ModelProperties',
'ModelProperty',
array(
'Title' => 'Title'
),
'getCMSFields_forPopup'
);
$propertiesTablefield->setAddTitle( 'a property' );

$fields->addFieldToTab( 'Root.Content.Properties', $propertiesTablefield );


/* Requires the DataObject Manager Module */
/*
$manager = new ImageDataObjectManager(
$this,
'PageImages',
'PageImage',
'Attachment',
array(
'Name' => 'Picturename',
'Description' => 'Description'
),
'getCMSFields_forPopup_pageimage'
);
$fields->addFieldToTab("Root.Content.Images",$manager);
*/
return $fields;
}
}


Post Comment