BUGFIX Checking for existence of "ShowInMenus" property in Folder->liveChildren() and stageChildren() (#5190) (from r101264)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@111978 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-12 21:58:49 +00:00
parent 1dcc5401f6
commit 0d5a0e73fe

View File

@ -512,11 +512,18 @@ class Hierarchy extends DataObjectDecorator {
/**
* 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 @@ class Hierarchy extends DataObjectDecorator {
/**
* 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);