From 3b0ab9b0a019c3e1df75b41e1036728834f71bac Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Fri, 17 Feb 2012 12:06:12 +1300 Subject: [PATCH] BUGFIX: SiteTree#getCMSFields referenced $linkedPages even if $linkedPages wasnt set --- code/model/SiteTree.php | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index f408b8a0..e7e85e33 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1760,36 +1760,36 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid // Create a status message for multiple parents if($this->ID && is_numeric($this->ID)) { $linkedPages = $this->VirtualPages(); - } - - $parentPageLinks = array(); - if($linkedPages->Count() > 0) { - foreach($linkedPages as $linkedPage) { - $parentPage = $linkedPage->Parent; - if($parentPage) { - if($parentPage->ID) { - $parentPageLinks[] = "ID\">{$parentPage->Title}"; - } else { - $parentPageLinks[] = "ID\">" . - _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . - ""; + $parentPageLinks = array(); + + if($linkedPages->Count() > 0) { + foreach($linkedPages as $linkedPage) { + $parentPage = $linkedPage->Parent; + if($parentPage) { + if($parentPage->ID) { + $parentPageLinks[] = "ID\">{$parentPage->Title}"; + } else { + $parentPageLinks[] = "ID\">" . + _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') . + ""; + } } } + + $lastParent = array_pop($parentPageLinks); + $parentList = "'$lastParent'"; + + if(count($parentPageLinks) > 0) { + $parentList = "'" . implode("', '", $parentPageLinks) . "' and " + . $parentList; + } + + $statusMessage[] = sprintf( + _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), + $parentList + ); } - - $lastParent = array_pop($parentPageLinks); - $parentList = "'$lastParent'"; - - if(count($parentPageLinks) > 0) { - $parentList = "'" . implode("', '", $parentPageLinks) . "' and " - . $parentList; - } - - $statusMessage[] = sprintf( - _t('SiteTree.APPEARSVIRTUALPAGES', "This content also appears on the virtual pages in the %s sections."), - $parentList - ); } if($this->HasBrokenLink || $this->HasBrokenFile) {