pause_player-8.x-1.3/pause_player.module
pause_player.module
<?php
/**
* @file
* Adds a theme function which allows theme developers to use the Pause Player.
*/
/**
* Implements hook_help()
* @param string $route_name
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* @return string
*/
function pause_player_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
switch ($route_name) {
//admin/help/pause_player : when admin click on the module in Manage/Extend/modules list
case 'help.page.pause_player':
return '<p>' . t('Full documentation on the official site of <span style="color: brown;">Pause Player</span> : <a href="@site" target="_blank">@site</a>', ['@site' => 'https://pause-player.com/documentation/']) . '</p>';
}
}
/**
* Exposes global variables in twig templates
* Implements hook_theme().
* See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/function/hook_theme/8.3.x
*/
function pause_player_theme($existing, $type, $theme, $path) {
return array(
'pause_player_formatter' => array(
'variables' => array(
'item' => NULL,
'item_attributes' => NULL,
'field_type' => NULL,
'idvideo' => NULL,
'url' => NULL,
'filename' => NULL,
'title' => NULL,
'mime' => NULL,
'size' => NULL,
'userOwnerName' => NULL,
'creationDate' => NULL,
'creationDateFormat' => NULL,
'modificationDate' => NULL,
'modificationDateFormat' => NULL,
'settings' => array()
),
),
);
}
/**
* Attach JS/CSS scripts in the template
* Implements hook_preprocess_page().
*/
function pause_player_preprocess_page(&$vars, $hook) {
// Render the library as laid out in pause_player.libraries.yml
$libraries['#attached']['library'][] = 'pause_player_library';
\Drupal::service('renderer')->renderRoot($libraries);
}
