public function comments($entity, $config = array())
    {
        $config = array_merge(array(
            'truncate_body' => array(),
            'editor' => false,
            'pagination' => true,
            'show_guest_prompt' => true,
            'content_filter_exclude' => array(),
         ),

         $config);

        $data = $this->getTemplate()->getData();
        $limit = isset($data['limit'])  ? $data['limit']  : 0;
        $offset = isset($data['start'])  ? $data['start']  : 0;

        if (!isset($config['comments'])) {
            $config['comments'] = $entity->comments->order('creationTime', 'ASC')->limit($limit, $offset);
        }

        if (!isset($config['can_comment'])) {
            $config['can_comment'] = false;
            if ($entity && $entity->isAuthorizer()) {
                $config['can_comment'] = $entity->authorize('add.comment');
                //if can't comment then check if it needs to follow
                if ($config['can_comment'] === false && $entity->__require_follow) {
                    $config['require_follow'] = true;
                }
            }
        }

        if (!isset($config['strip_tags'])) {
            $config['strip_tags'] = false;
        }

        $config['entity'] = $entity;

        if ($config['pagination'] === $config['comments'] instanceof AnDomainEntitysetDefault) {
            $config['pagination'] = $this->pagination($config['comments'], array('paginate' => true, 'options' => array('scrollToTop' => true)));
        }

        return $this->_render('comments', $config);
    }
public function comments($entity, $config = array())
    {
        $config = array_merge(array(
            'truncate_body' => array(),
            'editor' => false,
            'pagination' => true,
            'show_guest_prompt' => true,
            'content_filter_exclude' => array(),
         ),

         $config);

        $data = $this->getTemplate()->getData();
        $limit = isset($data['limit'])  ? $data['limit']  : 0;
        $offset = isset($data['start'])  ? $data['start']  : 0;

        if (!isset($config['comments'])) {
            $config['comments'] = $entity->comments->order('creationTime', 'ASC')->limit($limit, $offset);
        }

        if (!isset($config['can_comment'])) {
            $config['can_comment'] = false;
            if ($entity && $entity->isAuthorizer()) {
                $config['can_comment'] = $entity->authorize('add.comment');
                //if can't comment then check if it needs to follow
                if ($config['can_comment'] === false && $entity->__require_follow) {
                    $config['require_follow'] = true;
                }
            }
        }

        if (!isset($config['strip_tags'])) {
            $config['strip_tags'] = false;
        }

        $config['entity'] = $entity;

        if ($config['pagination'] === $config['comments'] instanceof AnDomainEntitysetDefault) {
            $config['pagination'] = $this->pagination($config['comments'], array('paginate' => true, 'options' => array('scrollToTop' => true)));
        }

        return $this->_render('comments', $config);
    }
public function comments ( $ entity , $ config = array ( ) ) { $ config = array_merge ( array ( 'truncate_body' => array ( ) , 'editor' => false , 'pagination' => true , 'show_guest_prompt' => true , 'content_filter_exclude' => array ( ) , ) , $ config ) ; $ data = $ this -> getTemplate ( ) -> getData ( ) ; $ limit = isset ( $ data [ 'limit' ] ) ? $ data [ 'limit' ] : 0 ; $ offset = isset ( $ data [ 'start' ] ) ? $ data [ 'start' ] : 0 ; if ( ! isset ( $ config [ 'comments' ] ) ) { $ config [ 'comments' ] = $ entity -> comments -> order ( 'creationTime' , 'ASC' ) -> limit ( $ limit , $ offset ) ; } if ( ! isset ( $ config [ 'can_comment' ] ) ) { $ config [ 'can_comment' ] = false ; if ( $ entity && $ entity -> isAuthorizer ( ) ) { $ config [ 'can_comment' ] = $ entity -> authorize ( 'add.comment' ) ; //if can't comment then check if it needs to follow if ( $ config [ 'can_comment' ] === false && $ entity -> __require_follow ) { $ config [ 'require_follow' ] = true ; } } } if ( ! isset ( $ config [ 'strip_tags' ] ) ) { $ config [ 'strip_tags' ] = false ; } $ config [ 'entity' ] = $ entity ; if ( $ config [ 'pagination' ] === $ config [ 'comments' ] instanceof AnDomainEntitysetDefault ) { $ config [ 'pagination' ] = $ this -> pagination ( $ config [ 'comments' ] , array ( 'paginate' => true , 'options' => array ( 'scrollToTop' => true ) ) ) ; } return $ this -> _render ( 'comments' , $ config ) ; }
Renders the comments for a commentable.

@param AnDomainEntityAbstract $entity The parent of the comments
@param array                  $config An array of configuration

@return string
Renders the comments for a commentable .