BUGFIX: SiteTree#getCMSFields referenced $linkedPages even if $linkedPages wasnt set

This commit is contained in:
Hamish Friedlander 2012-02-17 12:06:12 +13:00 committed by Stig Lindqvist
parent f620f9b46c
commit c3bf93468f

View File

@ -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();
$parentPageLinks = array();
if($linkedPages->Count() > 0) {
foreach($linkedPages as $linkedPage) {
$parentPage = $linkedPage->Parent;
if($parentPage) {
if($parentPage->ID) {
$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">{$parentPage->Title}</a>";
} else {
$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">" .
_t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') .
"</a>";
if($linkedPages->Count() > 0) {
foreach($linkedPages as $linkedPage) {
$parentPage = $linkedPage->Parent;
if($parentPage) {
if($parentPage->ID) {
$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">{$parentPage->Title}</a>";
} else {
$parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">" .
_t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') .
"</a>";
}
}
}
$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) {