mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Merge pull request #62 from silverstripe-scienceninjas/master
BUGFIX: SiteTree#getCMSFields would only calculate local variable $linkedPages if ID was valid, but would then refer to that variable regardless
This commit is contained in:
commit
703ac7b47e
@ -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[] = "<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>";
|
||||
$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>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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) {
|
||||
|
Loading…
Reference in New Issue
Block a user