From 98f7d9b644e0bc0862943059c1ca0193627241e8 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 1 May 2009 03:02:41 +0000 Subject: [PATCH] ENHANCEMENT: Added page location fields in the behaviour tab, as an alternative to drag and drop git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@75814 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/SiteTree.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 945e8e474..9df155697 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -1214,6 +1214,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $this->fieldLabel('ClassName'), $this->getClassDropdown() ), + + new OptionsetField("ParentType", "Page location", array( + "root" => _t("SiteTree.PARENTTYPE_ROOT", "Top-level page"), + "subpage" => _t("SiteTree.PARENTTYPE_SUBPAGE", "Sub-page underneath a parent page (choose below)"), + )), + new TreeDropdownField("ParentID", $this->fieldLabel('ParentID'), 'SiteTree'), + new CheckboxField("ShowInMenus", $this->fieldLabel('ShowInMenus')), new CheckboxField("ShowInSearch", $this->fieldLabel('ShowInSearch')), /*, new TreeMultiselectField("MultipleParents", "Page appears within", "SiteTree")*/ @@ -1310,6 +1317,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $labels['MetaKeywords'] = _t('SiteTree.METAKEYWORDS', "Keywords"); $labels['ExtraMeta'] = _t('SiteTree.METAEXTRA', "Custom Meta Tags"); $labels['ClassName'] = _t('SiteTree.PAGETYPE', "Page type", PR_MEDIUM, 'Classname of a page object'); + $labels['ParentType'] = _t('SiteTree.PARENTTYPE', "Page location", PR_MEDIUM); + $labels['ParentID'] = _t('SiteTree.PARENTID', "Parent page", PR_MEDIUM); $labels['ShowInMenus'] =_t('SiteTree.SHOWINMENUS', "Show in menus?"); $labels['ShowInSearch'] = _t('SiteTree.SHOWINSEARCH', "Show in search?"); $labels['ProvideComments'] = _t('SiteTree.ALLOWCOMMENTS', "Allow comments on this page?"); @@ -1878,6 +1887,10 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid return $entities; } + + function getParentType() { + return $this->ParentID == 0 ? 'root' : 'subpage'; + } } ?> \ No newline at end of file