You are here

function _spaces_core_views_blog_comments in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_core/spaces_core.module \_spaces_core_views_blog_comments()
1 string reference to '_spaces_core_views_blog_comments'
spaces_core_views_default_views in spaces_core/spaces_core.module
Implementation of hook_default_views().

File

spaces_core/spaces_core.module, line 453

Code

function _spaces_core_views_blog_comments() {
  $view = new stdClass();
  $view->name = 'spaces_blog_comments';
  $view->description = t('');
  $view->access = array();
  $view->view_args_php = '';
  $view->page = FALSE;
  $view->block = TRUE;
  $view->block_title = t('Recent Comments');
  $view->block_empty = "<p class='views-empty'>" . t('No recent comments.') . "</p>";
  $view->block_empty_format = '1';
  $view->block_type = 'spaces_datetitle';
  $view->nodes_per_block = '5';
  $view->sort = array(
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array();
  $view->field = array(
    array(
      'tablename' => 'comments',
      'field' => 'subject',
      'label' => t('Comment'),
      'handler' => 'views_handler_field_commentlink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'comments',
      'field' => 'name',
      'label' => t('By'),
    ),
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => t('On Post'),
      'handler' => 'views_handler_field_nodelink',
      'options' => 'nolink',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'label' => t('Date'),
      'handler' => 'views_handler_field_date_small',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'comment_count',
      'operator' => '>',
      'options' => '',
      'value' => '0',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array(
        0 => 'blog',
      ),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'all',
      'options' => '',
      'value' => 'all',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'operator' => '>',
      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
      'value' => 'now',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    node_comment_statistics,
    comments,
    node,
  );
  return $view;
}