You are here

function bibcite_preprocess_bibcite_citation in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x bibcite.module \bibcite_preprocess_bibcite_citation()

Implements hook_preprocess_HOOK().

File

./bibcite.module, line 28
Main module hooks.

Code

function bibcite_preprocess_bibcite_citation(&$variables) {

  /** @var \Drupal\bibcite\CitationStylerInterface $styler */
  $styler = \Drupal::service('bibcite.citation_styler');
  $data = $variables['data'];
  if ($variables['style']) {
    $styler
      ->setStyleById($variables['style']);
  }
  else {
    $styler
      ->setStyle(NULL);
  }
  $variables['content'] = [
    '#markup' => $styler
      ->render($data),
  ];
}