mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
ENHANCEMENt Added tree-based fields
This commit is contained in:
parent
e815c5bf09
commit
fbf955f602
@ -2,6 +2,7 @@
|
||||
|
||||
Object::add_extension('Member', 'FrameworkTestRole');
|
||||
Object::add_extension('Member', 'FileUploadRole');
|
||||
Object::add_extension('SiteTree', 'FrameworkTestSiteTreeExtension');
|
||||
|
||||
if(class_exists('SiteTreeCMSWorkflow')) {
|
||||
Object::add_extension('SiteConfig', 'CMSWorkflowSiteConfigDecorator');
|
||||
|
@ -127,6 +127,8 @@ class BasicFieldsTestPage extends TestPage {
|
||||
}
|
||||
}
|
||||
|
||||
$fields->addFieldToTab('Root.Text', new TextField('Text_NoLabel', false, 'TextField without label'), 'Text_disabled');
|
||||
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
11
code/FrameworkTestSiteTreeExtension.php
Normal file
11
code/FrameworkTestSiteTreeExtension.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
class FrameworkTestSiteTreeExtension extends DataExtension {
|
||||
|
||||
function extraStatics() {
|
||||
return array(
|
||||
'has_one' => array('RelationFieldsTestPage' => 'RelationFieldsTestPage'),
|
||||
'belongs_many_many' => array('RelationFieldsTestPages' => 'RelationFieldsTestPage'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -4,35 +4,34 @@ class RelationFieldsTestPage extends TestPage {
|
||||
|
||||
static $has_one = array(
|
||||
"HasOneCompany" => "Company",
|
||||
"HasOnePage" => "SiteTree",
|
||||
);
|
||||
static $has_many = array(
|
||||
"HasManyCompanies" => "Company",
|
||||
"HasManyPages" => "SiteTree",
|
||||
);
|
||||
static $many_many = array(
|
||||
"ManyManyCompanies" => "Company",
|
||||
"ManyManyPages" => "SiteTree",
|
||||
);
|
||||
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$fields->addFieldToTab("Root.CheckboxSet",
|
||||
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
|
||||
|
||||
$fields->addFieldToTab("Root.CTF",
|
||||
new ComplexTableField($this, "HasManyCompanies", "TestCTFItem")
|
||||
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map())
|
||||
);
|
||||
|
||||
// TODO Fix legacy relation CTFs in 3.0
|
||||
|
||||
// $fields->addFieldToTab("Root.HasOneCTF",
|
||||
// new HasOneComplexTableField($this, "HasOneCompany");
|
||||
|
||||
// $fields->addFieldToTab("Root.HasManyCTF",
|
||||
// new HasManyComplexTableField($this, "HasManyCompanies");
|
||||
|
||||
// $fields->addFieldToTab("Root.ManyManyCTF",
|
||||
// new ManyManyComplexTableField($this, "ManyManyCompanies");
|
||||
$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)
|
||||
));
|
||||
|
||||
// TODO Fix CTF in 3.0
|
||||
// $fields->addFieldToTab("Root.CTF",
|
||||
// new ComplexTableField($this, "HasManyCompanies", "TestCTFItem")
|
||||
// );
|
||||
|
||||
// $fields->addFieldToTab("Root.Tests.ComplexTableField",
|
||||
// new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
|
||||
|
Loading…
Reference in New Issue
Block a user