silverstripe-frameworktest/code/RelationFieldsTestPage.php

54 lines
1.6 KiB
PHP
Raw Normal View History

2008-10-03 00:05:45 +02:00
<?php
class RelationFieldsTestPage extends TestPage {
static $has_one = array(
"FavouriteItem" => "TestCTFItem",
2008-10-03 00:05:45 +02:00
);
static $has_many = array(
2008-10-03 00:05:45 +02:00
"Items" => "TestCTFItem",
);
static $many_many = array(
"CheckboxSet" => "TestCategory",
);
2008-10-03 00:05:45 +02:00
function getCMSFields() {
$fields = parent::getCMSFields();
2009-05-15 06:05:09 +02:00
$fields->addFieldToTab("Root.Content.CheckboxSet",
2008-10-03 00:05:45 +02:00
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
/*
2008-10-03 00:05:45 +02:00
$fields->addFieldToTab("Root.Content.ComplexTableField",
new ComplexTableField($this, "Items", "TestCTFItem", array(
"Title" => "Item Title",
"Author" => "Item Author")));
*/
$fields->addFieldToTab("Root.Content.HasOneComplexTableField",
new HasOneComplexTableField($this, "FavouriteItem", "TestCTFItem", array(
"Title" => "Item Title",
"Author" => "Item Author")));
$fields->addFieldToTab("Root.Content.HasManyComplexTableField",
new HasManyComplexTableField($this, "Items", "TestCTFItem", array(
"Title" => "Item Title",
"Author" => "Item Author")));
$fields->addFieldToTab("Root.Content.ManyManyComplexTableField",
new ManyManyComplexTableField($this, "CheckboxSet", "TestCategory", array(
"Title" => "Item Title")));
2008-10-03 00:05:45 +02:00
// $fields->addFieldToTab("Root.Tests.ComplexTableField",
// new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
// $fields->addFieldToTab("Root.Tests.CheckboxSet", new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
return $fields;
}
}
class RelationFieldsTestPage_Controller extends TestPage_Controller {
}
?>