mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-06-16 17:51:31 +02:00
Merge pull request #65 from catcherdev/master
Prevent errors when comments' parent pages have been removed
This commit is contained in:
commit
b448232423
|
@ -100,7 +100,9 @@ class Comment extends DataObject {
|
||||||
* @return string link to this comment.
|
* @return string link to this comment.
|
||||||
*/
|
*/
|
||||||
public function Link($action = "") {
|
public function Link($action = "") {
|
||||||
return $this->getParent()->Link($action) . '#' . $this->Permalink();
|
if($parent = $this->getParent()){
|
||||||
|
return $parent->Link($action) . '#' . $this->Permalink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,9 +156,9 @@ class Comment extends DataObject {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getParentTitle() {
|
public function getParentTitle() {
|
||||||
$parent = $this->getParent();
|
if($parent = $this->getParent()){
|
||||||
|
|
||||||
return ($parent && $parent->Title) ? $parent->Title : $parent->ClassName . " #" . $parent->ID;
|
return ($parent && $parent->Title) ? $parent->Title : $parent->ClassName . " #" . $parent->ID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user