Skip to content
Browse files

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

… #6811
  • Loading branch information...
1 parent 9540e24 commit e17b4a185a997b288324395e0bda45f4bc59da69 @wilr wilr committed
Showing with 21 additions and 12 deletions.
  1. +16 −7 code/controllers/CMSMain.php
  2. +1 −1 code/model/ErrorPage.php
  3. +1 −1 code/model/RedirectorPage.php
  4. +3 −3 code/model/VirtualPage.php
View
23 code/controllers/CMSMain.php
@@ -225,24 +225,33 @@ public function SiteTreeHints() {
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();
+
+ // 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) {
- $def[$disallowedChild]['disallowedParents'][] = $class;
+ 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?
+ // Are any classes allowed to be parents of root?
$def['Root']['disallowedParents'][] = $class;
}
View
2 code/model/ErrorPage.php
@@ -133,7 +133,7 @@ function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab(
- "Root.Content",
+ "Root.Main",
new DropdownField(
"ErrorCode",
$this->fieldLabel('ErrorCode'),
View
2 code/model/RedirectorPage.php
@@ -128,7 +128,7 @@ function getCMSFields() {
$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
6 code/model/VirtualPage.php
@@ -172,17 +172,17 @@ function getCMSFields($cms = null) {
}
// 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"
);

0 comments on commit e17b4a1

Please sign in to comment.
Something went wrong with that request. Please try again.