silverstripe-blog/src/Model/BlogCommentExtension.php
2024-01-19 09:58:02 +13:00

33 lines
657 B
PHP

<?php
namespace SilverStripe\Blog\Model;
use SilverStripe\Comments\Model\Comment;
use SilverStripe\ORM\DataExtension;
/**
* Adds Blog specific behaviour to Comment.
*
* @extends DataExtension<Comment>
*/
class BlogCommentExtension extends DataExtension
{
/**
* Extra CSS classes for styling different comment types.
*
* @return string
*/
public function getExtraClass()
{
$blogPost = $this->owner->Parent();
if ($blogPost instanceof BlogPost) {
if ($blogPost->isAuthor($this->owner->Author())) {
return 'author-comment';
}
}
return '';
}
}