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', 'FrameworkTestRole');
|
||||||
Object::add_extension('Member', 'FileUploadRole');
|
Object::add_extension('Member', 'FileUploadRole');
|
||||||
|
Object::add_extension('SiteTree', 'FrameworkTestSiteTreeExtension');
|
||||||
|
|
||||||
if(class_exists('SiteTreeCMSWorkflow')) {
|
if(class_exists('SiteTreeCMSWorkflow')) {
|
||||||
Object::add_extension('SiteConfig', 'CMSWorkflowSiteConfigDecorator');
|
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;
|
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(
|
static $has_one = array(
|
||||||
"HasOneCompany" => "Company",
|
"HasOneCompany" => "Company",
|
||||||
|
"HasOnePage" => "SiteTree",
|
||||||
);
|
);
|
||||||
static $has_many = array(
|
static $has_many = array(
|
||||||
"HasManyCompanies" => "Company",
|
"HasManyCompanies" => "Company",
|
||||||
|
"HasManyPages" => "SiteTree",
|
||||||
);
|
);
|
||||||
static $many_many = array(
|
static $many_many = array(
|
||||||
"ManyManyCompanies" => "Company",
|
"ManyManyCompanies" => "Company",
|
||||||
|
"ManyManyPages" => "SiteTree",
|
||||||
);
|
);
|
||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$fields->addFieldToTab("Root.CheckboxSet",
|
$fields->addFieldToTab("Root.CheckboxSet",
|
||||||
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
|
new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map())
|
||||||
|
|
||||||
$fields->addFieldToTab("Root.CTF",
|
|
||||||
new ComplexTableField($this, "HasManyCompanies", "TestCTFItem")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO Fix legacy relation CTFs in 3.0
|
$fields->addFieldsToTab('Root.Tree', array(
|
||||||
|
Object::create('TreeDropdownField', 'HasOnePage', 'HasOnePage', 'SiteTree'),
|
||||||
// $fields->addFieldToTab("Root.HasOneCTF",
|
Object::create('TreeMultiselectField', 'HasManyPages', 'HasManyPages', 'SiteTree'),
|
||||||
// new HasOneComplexTableField($this, "HasOneCompany");
|
Object::create('TreeMultiselectField', 'ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true)
|
||||||
|
));
|
||||||
// $fields->addFieldToTab("Root.HasManyCTF",
|
|
||||||
// new HasManyComplexTableField($this, "HasManyCompanies");
|
|
||||||
|
|
||||||
// $fields->addFieldToTab("Root.ManyManyCTF",
|
|
||||||
// new ManyManyComplexTableField($this, "ManyManyCompanies");
|
|
||||||
|
|
||||||
|
// TODO Fix CTF in 3.0
|
||||||
|
// $fields->addFieldToTab("Root.CTF",
|
||||||
|
// new ComplexTableField($this, "HasManyCompanies", "TestCTFItem")
|
||||||
|
// );
|
||||||
|
|
||||||
// $fields->addFieldToTab("Root.Tests.ComplexTableField",
|
// $fields->addFieldToTab("Root.Tests.ComplexTableField",
|
||||||
// new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
|
// new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
|
||||||
|
Loading…
Reference in New Issue
Block a user