bibcite.module in Bibliography & Citation 2.0.x
Same filename and directory in other branches
Main module hooks.
File
bibcite.moduleView source
<?php
/**
* @file
* Main module hooks.
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
/**
* Implements hook_theme().
*/
function bibcite_theme($existing, $type, $theme, $path) {
return [
'bibcite_citation' => [
'variables' => [
'data' => [],
'style' => NULL,
],
],
];
}
/**
* Implements hook_preprocess_HOOK().
*/
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),
];
}
/**
* Implements hook_help().
*/
function bibcite_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.bibcite':
$links = [
':proc' => Url::fromRoute('bibcite.settings')
->toString(),
':csl' => Url::fromRoute('entity.bibcite_csl_style.collection')
->toString(),
];
$module = 'bibcite';
return \Drupal::service('bibcite.help_service')
->getHelpMarkup($links, $route_name, $module);
}
}
Functions
Name | Description |
---|---|
bibcite_help | Implements hook_help(). |
bibcite_preprocess_bibcite_citation | Implements hook_preprocess_HOOK(). |
bibcite_theme | Implements hook_theme(). |