function adaptivetheme_preprocess_comment

cis7 preprocess.inc adaptivetheme_preprocess_comment(&$vars)
cle7 preprocess.inc adaptivetheme_preprocess_comment(&$vars)
elmsmedia7 preprocess.inc adaptivetheme_preprocess_comment(&$vars)
icor7 preprocess.inc adaptivetheme_preprocess_comment(&$vars)
meedjum_blog7 preprocess.inc adaptivetheme_preprocess_comment(&$vars)
mooc7 preprocess.inc adaptivetheme_preprocess_comment(&$vars)

Preprocess variables for comment.tpl.php

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/preprocess.inc, line 761
All Preprocess functions for templates and theme fucntions. If you need to add or modify preprocess functions do it in your sub-theme.

Code

function adaptivetheme_preprocess_comment(&$vars) {
  global $theme_key;
  $theme_name = $theme_key;

  // Extra comment classes if required
  if (at_get_setting('extra_comment_classes', $theme_name) === 1) {

    // Zebra
    $vars['classes_array'][] = $vars['zebra'];

    // Position?
    if ($vars['id'] === 1) {
      $vars['classes_array'][] = 'first';
    }
    if ($vars['id'] === $vars['node']->comment_count) {
      $vars['classes_array'][] = 'last';
    }

    // Title hidden?
    if (at_get_setting('comments_hide_title', $theme_name) === 1) {
      $vars['classes_array'][] = 'comment-title-hidden';
    }

    // User picture?
    // Should we add a check for the global settings here? SEE: https://drupal.org/node/2020687
    if (at_get_setting('toggle_comment_user_picture', $theme_name) === 1) {
      if (!empty($vars['picture'])) {
        $vars['classes_array'][] = 'comment-with-picture';
      }
    }

    // Signature?
    if (!empty($vars['signature'])) {
      $vars['classes_array'][] = 'comment-with-signature';
    }
  }

  // Classes for comment title
  $vars['title_attributes_array']['class'][] = 'comment-title';

  // Title hidden?
  if (at_get_setting('enable_extensions', $theme_name) === 1) {
    if (at_get_setting('enable_markup_overides', $theme_name) === 1) {
      if (at_get_setting('comments_hide_title', $theme_name) === 1) {
        $vars['title_attributes_array']['class'][] = 'element-invisible';
      }
    }
  }

  // Classes for comment content
  $vars['content_attributes_array']['class'][] = 'comment-content';

  // header, submitted and links wrappers have their own attributes
  $vars['header_attributes_array']['class'][] = 'comment-header';
  $vars['footer_attributes_array']['class'][] = 'submitted';
  if ($vars['picture']) {
    $vars['footer_attributes_array']['class'][] = 'with-user-picture';
  }
  $vars['links_attributes_array']['class'][] = 'clearfix';

  // Build the submitted by, permalink, title and time elements
  $uri = entity_uri('comment', $vars['comment']);
  $uri['options'] += array('attributes' => array('rel' => 'bookmark'));
  $vars['title'] = l($vars['comment']->subject, $uri['path'], $uri['options']);

  // Don't rebuild the permalink variable if Advanced Forum is enabled
  if (!module_exists('advanced_forum')) {
    $vars['permalink'] = l(t('Permalink'), $uri['path'], $uri['options']);
  }

  $vars['created'] = '<span class="date-time">' . $vars['created'] . '</span>';

  $vars['datetime'] = format_date($vars['comment']->created, 'custom', 'Y-m-d\TH:i:s\Z'); // Generate the timestamp, PHP "c" format is wrong

  $vars['submitted'] = t('Submitted by !username on !datetime', array(
    '!username' => $vars['author'],
    '!datetime' => '<time datetime="' . $vars['datetime'] . '" pubdate="pubdate">' . $vars['created'] . '</time>',
  ));

  // Unpublished?
  $vars['unpublished'] = ''; // Initialize for backwards compatibility
  if ($vars['status'] === 'comment-unpublished') {
    // Use the title prefix to render the unpublished message
    $vars['title_prefix']['unpublished']['#markup'] = '<p class="unpublished">' . t('Unpublished') . '</p>';
  }
}