BUGFIX Fixed case where SiteTree->getCMSFields() is missing a parent page, and thus it results in a non-object

MINOR Removed unused variable $parentPageTitle, and added missing array that wasn't defined (but used later on causing an undefined variable error)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@76948 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-15 02:45:25 +00:00 committed by Sam Minnee
parent c0ae471423
commit 60623a42c3

View File

@ -1128,18 +1128,20 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if($this->ID && is_numeric($this->ID)) {
$linkedPages = DataObject::get("VirtualPage", "CopyContentFromID = $this->ID");
}
$parentPageLinks = array();
if(isset($linkedPages)) {
foreach($linkedPages as $linkedPage) {
$parentPage = $linkedPage->Parent;
$parentPageTitle = $parentPage->Title;
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($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>";
}
}
}