silverstripe-blog/code/extensions/BlogCommentExtension.php

26 lines
508 B
PHP
Raw Normal View History

<?php
/**
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()
{
$blogPost = $this->owner->getParent();
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 '';
}
}