mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR: update PageTypes to use updated tab path for CMS fields. Fixes #6811
This commit is contained in:
parent
9540e248e7
commit
e17b4a185a
@ -225,24 +225,33 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
foreach($classes as $class) {
|
foreach($classes as $class) {
|
||||||
$obj = singleton($class);
|
$obj = singleton($class);
|
||||||
|
|
||||||
if($obj instanceof HiddenClass) continue;
|
if($obj instanceof HiddenClass) continue;
|
||||||
|
|
||||||
$allowedChildren = $obj->allowedChildren();
|
$allowedChildren = $obj->allowedChildren();
|
||||||
//SiteTree::allowedChildren() returns null rather than an empty array if SiteTree::allowed_chldren == 'none'
|
|
||||||
if ($allowedChildren == null) $allowedChildren = array();
|
// SiteTree::allowedChildren() returns null rather than an empty array if SiteTree::allowed_chldren == 'none'
|
||||||
|
if($allowedChildren == null) $allowedChildren = array();
|
||||||
|
|
||||||
$def[$class]['disallowedChildren'] = array_keys(array_diff($classes, $allowedChildren));
|
$def[$class]['disallowedChildren'] = array_keys(array_diff($classes, $allowedChildren));
|
||||||
|
|
||||||
$defaultChild = $obj->defaultChild();
|
$defaultChild = $obj->defaultChild();
|
||||||
if ($defaultChild != 'Page' && $defaultChild != null) $def[$class]['defaultChild'] = $defaultChild;
|
|
||||||
|
|
||||||
$defaultParent = isset(SiteTree::get_by_link($obj->defaultParent())->ID) ? SiteTree::get_by_link($obj->defaultParent())->ID : null;
|
if($defaultChild != 'Page' && $defaultChild != null)
|
||||||
|
$def[$class]['defaultChild'] = $defaultChild;
|
||||||
|
|
||||||
|
$id = SiteTree::get_by_link($obj->defaultParent())->ID;
|
||||||
|
$defaultParent = $id ? SiteTree::get_by_link($obj->defaultParent())->ID : null;
|
||||||
|
|
||||||
if ($defaultParent != 1 && $defaultParent != null) $def[$class]['defaultParent'] = $defaultParent;
|
if ($defaultParent != 1 && $defaultParent != null) $def[$class]['defaultParent'] = $defaultParent;
|
||||||
|
|
||||||
if(is_array($def[$class]['disallowedChildren'])) foreach($def[$class]['disallowedChildren'] as $disallowedChild) {
|
if(is_array($def[$class]['disallowedChildren'])) {
|
||||||
$def[$disallowedChild]['disallowedParents'][] = $class;
|
foreach($def[$class]['disallowedChildren'] as $disallowedChild) {
|
||||||
|
$def[$disallowedChild]['disallowedParents'][] = $class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Are any classes allowed to be parents of root?
|
// Are any classes allowed to be parents of root?
|
||||||
$def['Root']['disallowedParents'][] = $class;
|
$def['Root']['disallowedParents'][] = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class ErrorPage extends Page {
|
|||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$fields->addFieldToTab(
|
$fields->addFieldToTab(
|
||||||
"Root.Content",
|
"Root.Main",
|
||||||
new DropdownField(
|
new DropdownField(
|
||||||
"ErrorCode",
|
"ErrorCode",
|
||||||
$this->fieldLabel('ErrorCode'),
|
$this->fieldLabel('ErrorCode'),
|
||||||
|
@ -128,7 +128,7 @@ class RedirectorPage extends Page {
|
|||||||
$fields->removeByName('MetaDescription');
|
$fields->removeByName('MetaDescription');
|
||||||
$fields->removeByName('ExtraMeta');
|
$fields->removeByName('ExtraMeta');
|
||||||
|
|
||||||
$fields->addFieldsToTab('Root.Content',
|
$fields->addFieldsToTab('Root.Main',
|
||||||
array(
|
array(
|
||||||
new HeaderField('RedirectorDescHeader',_t('RedirectorPage.HEADER', "This page will redirect users to another page")),
|
new HeaderField('RedirectorDescHeader',_t('RedirectorPage.HEADER', "This page will redirect users to another page")),
|
||||||
new OptionsetField(
|
new OptionsetField(
|
||||||
|
@ -172,17 +172,17 @@ class VirtualPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add fields to the tab
|
// Add fields to the tab
|
||||||
$fields->addFieldToTab("Root.Content",
|
$fields->addFieldToTab("Root.Main",
|
||||||
new HeaderField('VirtualPageHeader',_t('VirtualPage.HEADER', "This is a virtual page")),
|
new HeaderField('VirtualPageHeader',_t('VirtualPage.HEADER', "This is a virtual page")),
|
||||||
"Title"
|
"Title"
|
||||||
);
|
);
|
||||||
$fields->addFieldToTab("Root.Content", $copyContentFromField, "Title");
|
$fields->addFieldToTab("Root.Main", $copyContentFromField, "Title");
|
||||||
|
|
||||||
// Create links back to the original object in the CMS
|
// Create links back to the original object in the CMS
|
||||||
if($this->CopyContentFrom()->ID) {
|
if($this->CopyContentFrom()->ID) {
|
||||||
$linkToContent = "<a class=\"cmsEditlink\" href=\"admin/show/$this->CopyContentFromID\">" .
|
$linkToContent = "<a class=\"cmsEditlink\" href=\"admin/show/$this->CopyContentFromID\">" .
|
||||||
_t('VirtualPage.EDITCONTENT', 'click here to edit the content') . "</a>";
|
_t('VirtualPage.EDITCONTENT', 'click here to edit the content') . "</a>";
|
||||||
$fields->addFieldToTab("Root.Content",
|
$fields->addFieldToTab("Root.Main",
|
||||||
$linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent),
|
$linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent),
|
||||||
"Title"
|
"Title"
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user