mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
5817eea314
If an author creates a comment include a highlight class
24 lines
482 B
PHP
24 lines
482 B
PHP
<?php
|
|
|
|
/**
|
|
* Adds Blog specific behaviour to Comment
|
|
* Extends {@see Comment}
|
|
*/
|
|
class BlogCommentExtension extends DataExtension {
|
|
|
|
/**
|
|
* Extra CSS classes for styling different comment types.
|
|
* @return string
|
|
*/
|
|
public function getExtraClass() {
|
|
$blogPost = $this->owner->getParent();
|
|
|
|
// Make sure we're dealing with a BlogPost.
|
|
if ( ($blogPost instanceof BlogPost)
|
|
&& $blogPost->isAuthor($this->owner->Author())
|
|
) {
|
|
return 'author-comment';
|
|
}
|
|
}
|
|
}
|