FIX Check if page exists

This commit is contained in:
Will Rossiter 2020-04-14 09:16:23 +12:00
parent 72d77a00c2
commit 03b47fb8eb
No known key found for this signature in database
GPG Key ID: F24330E3B4B95B75
1 changed files with 13 additions and 5 deletions

View File

@ -35,11 +35,19 @@ class BrokenExternalLinksReport extends SS_Report {
"title" => 'Page link is on',
'formatting' => function($value, $item) {
$page = $item->Page();
return sprintf(
'<a href="%s">%s</a>',
Convert::raw2att($page->CMSEditLink()),
Convert::raw2xml($page->Title)
);
if ($page) {
return sprintf(
'<a href="%s">%s</a>',
Convert::raw2att($page->CMSEditLink()),
Convert::raw2xml($page->Title)
);
} else {
return sprintf(
'%s',
$item->Track()->PageID
);
}
}
)
);