silverstripe-frameworktest/code/RelationFieldsTestPage.php

41 lines
1.2 KiB
PHP
Raw Normal View History

2008-10-03 00:05:45 +02:00
<?php
class RelationFieldsTestPage extends TestPage {
static $has_one = array(
"HasOneCompany" => "Company",
2012-03-08 10:36:12 +01:00
"HasOnePage" => "SiteTree",
2008-10-03 00:05:45 +02:00
);
static $has_many = array(
"HasManyCompanies" => "Company",
2012-03-08 10:36:12 +01:00
"HasManyPages" => "SiteTree",
2008-10-03 00:05:45 +02:00
);
static $many_many = array(
"ManyManyCompanies" => "Company",
2012-03-08 10:36:12 +01:00
"ManyManyPages" => "SiteTree",
);
2008-10-03 00:05:45 +02:00
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.CheckboxSet",
2012-03-08 10:36:12 +01:00
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map())
);
2012-03-08 10:36:12 +01:00
$fields->addFieldsToTab('Root.Tree', array(
Object::create('TreeDropdownField', 'HasOnePage', 'HasOnePage', 'SiteTree'),
Object::create('TreeMultiselectField', 'HasManyPages', 'HasManyPages', 'SiteTree'),
Object::create('TreeMultiselectField', 'ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true)
));
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 {
}