Permalink
Browse files

BUGFIX Checking for existence of "ShowInMenus" property in Folder->li…

…veChildren() and stageChildren() (#5190) (from r101264)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111978 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 1dcc540 commit 0d5a0e73fed70eb907140443a8d17fd3424f7608 @sminnee sminnee committed Oct 12, 2010
Showing with 15 additions and 2 deletions.
  1. +15 −2 core/model/Hierarchy.php
View
@@ -512,11 +512,18 @@ public function numChildren($cache = true) {
/**
* Return children from the stage site
+ *
* @param showAll Inlcude all of the elements, even those not shown in the menus.
+ * (only applicable when extension is applied to {@link SiteTree}).
* @return DataObjectSet
*/
public function stageChildren($showAll = false) {
- $extraFilter = $showAll ? '' : " AND \"ShowInMenus\"=1";
+ if($this->owner->db('ShowInMenus')) {
+ $extraFilter = ($showAll) ? '' : " AND \"ShowInMenus\"=1";
+ } else {
+ $extraFilter = '';
+ }
+
$baseClass = ClassInfo::baseDataClass($this->owner->class);
$staged = DataObject::get($baseClass, "\"{$baseClass}\".\"ParentID\" = "
@@ -530,12 +537,18 @@ public function stageChildren($showAll = false) {
/**
* Return children from the live site, if it exists.
+ *
* @param boolean $showAll Include all of the elements, even those not shown in the menus.
+ * (only applicable when extension is applied to {@link SiteTree}).
* @param boolean $onlyDeletedFromStage Only return items that have been deleted from stage
* @return DataObjectSet
*/
public function liveChildren($showAll = false, $onlyDeletedFromStage = false) {
- $extraFilter = $showAll ? '' : " AND \"ShowInMenus\"=1";
+ if($this->owner->db('ShowInMenus')) {
+ $extraFilter = ($showAll) ? '' : " AND \"ShowInMenus\"=1";
+ } else {
+ $extraFilter = '';
+ }
$join = "";
$baseClass = ClassInfo::baseDataClass($this->owner->class);

0 comments on commit 0d5a0e7

Please sign in to comment.