You are here

function template_preprocess_rate_template_thumbs_up in Rate 8

Implements hook_preprocess_HOOK() for rate-template-thumbs_up.html.twig.

File

./rate.module, line 310
Hook implementation code for the Rate module.

Code

function template_preprocess_rate_template_thumbs_up(&$variables) {
  $variables['up_attributes'] = new Attribute();
  $variables['up_attributes']['class'] = [];
  $variables['up_attributes']['class'][] = 'rate-thumbs-up-btn-up';
  if ($variables['use_ajax'] && !$variables['has_voted'] && $variables['can_vote']) {
    $variables['up_attributes']['class'][] = 'use-ajax';
  }
  $variables['score_attributes'] = new Attribute();
  $variables['score_attributes']['class'] = [];
  $variables['score_attributes']['class'][] = 'rate-score';
  $variables['up_votes'] = isset($variables['results']['updown']['rate_count_up']) ? $variables['results']['updown']['rate_count_up'] : 0;
  _rate_set_common_theme_variables($variables);
  _rate_get_undo_link($variables);
  $variables['#attached']['library'][] = 'rate/thumbs-up';
}