silverstripe-blog/src/Model/BlogCommentExtension.php

30 lines
578 B
PHP
Raw Normal View History

<?php
namespace SilverStripe\Blog\Model;
use SilverStripe\ORM\DataExtension;
/**
2015-05-09 16:33:12 +02:00
* Adds Blog specific behaviour to Comment.
*/
2015-11-21 07:17:29 +01:00
class BlogCommentExtension extends DataExtension
{
/**
* Extra CSS classes for styling different comment types.
*
* @return string
*/
public function getExtraClass()
{
2022-11-25 00:43:00 +01:00
$blogPost = $this->owner->Parent();
2015-05-09 16:33:12 +02:00
2015-11-21 07:17:29 +01:00
if ($blogPost instanceof BlogPost) {
if ($blogPost->isAuthor($this->owner->Author())) {
return 'author-comment';
}
}
2015-05-09 16:33:12 +02:00
2015-11-21 07:17:29 +01:00
return '';
}
}