MINOR: update PageTypes to use updated tab path for CMS fields. Fixes #6811

This commit is contained in:
Will Rossiter 2011-12-17 16:45:09 +13:00
parent 9540e248e7
commit e17b4a185a
4 changed files with 21 additions and 12 deletions

View File

@ -225,22 +225,31 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
foreach($classes as $class) {
$obj = singleton($class);
if($obj instanceof HiddenClass) continue;
$allowedChildren = $obj->allowedChildren();
// 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));
$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(is_array($def[$class]['disallowedChildren'])) foreach($def[$class]['disallowedChildren'] as $disallowedChild) {
if(is_array($def[$class]['disallowedChildren'])) {
foreach($def[$class]['disallowedChildren'] as $disallowedChild) {
$def[$disallowedChild]['disallowedParents'][] = $class;
}
}
// Are any classes allowed to be parents of root?
$def['Root']['disallowedParents'][] = $class;

View File

@ -133,7 +133,7 @@ class ErrorPage extends Page {
$fields = parent::getCMSFields();
$fields->addFieldToTab(
"Root.Content",
"Root.Main",
new DropdownField(
"ErrorCode",
$this->fieldLabel('ErrorCode'),

View File

@ -128,7 +128,7 @@ class RedirectorPage extends Page {
$fields->removeByName('MetaDescription');
$fields->removeByName('ExtraMeta');
$fields->addFieldsToTab('Root.Content',
$fields->addFieldsToTab('Root.Main',
array(
new HeaderField('RedirectorDescHeader',_t('RedirectorPage.HEADER', "This page will redirect users to another page")),
new OptionsetField(

View File

@ -172,17 +172,17 @@ class VirtualPage extends Page {
}
// Add fields to the tab
$fields->addFieldToTab("Root.Content",
$fields->addFieldToTab("Root.Main",
new HeaderField('VirtualPageHeader',_t('VirtualPage.HEADER', "This is a virtual page")),
"Title"
);
$fields->addFieldToTab("Root.Content", $copyContentFromField, "Title");
$fields->addFieldToTab("Root.Main", $copyContentFromField, "Title");
// Create links back to the original object in the CMS
if($this->CopyContentFrom()->ID) {
$linkToContent = "<a class=\"cmsEditlink\" href=\"admin/show/$this->CopyContentFromID\">" .
_t('VirtualPage.EDITCONTENT', 'click here to edit the content') . "</a>";
$fields->addFieldToTab("Root.Content",
$fields->addFieldToTab("Root.Main",
$linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent),
"Title"
);