silverstripe-blog/code/extensions/BlogCommentExtension.php

26 lines
508 B
PHP
Raw Normal View History

<?php
/**
2015-05-10 02:33:12 +12:00
* Adds Blog specific behaviour to Comment.
*/
2015-11-21 19:17:29 +13:00
class BlogCommentExtension extends DataExtension
{
/**
* Extra CSS classes for styling different comment types.
*
* @return string
*/
public function getExtraClass()
{
$blogPost = $this->owner->getParent();
2015-05-10 02:33:12 +12:00
2015-11-21 19:17:29 +13:00
if ($blogPost instanceof BlogPost) {
if ($blogPost->isAuthor($this->owner->Author())) {
return 'author-comment';
}
}
2015-05-10 02:33:12 +12:00
2015-11-21 19:17:29 +13:00
return '';
}
}