cash-1.0.0/cash.module
cash.module
<?php
/**
* @file
* An absurdly small jQuery alternative for modern browsers (IE9+).
*/
use Drupal\cash\Cash;
/**
* Provides a convenient shortcut for procedural hooks.
*
* @return \Drupal\cash\Cash
* The Cash manager class instance.
*/
// @codingStandardsIgnoreStart
function cash(): Cash {
static $manager;
if (!isset($manager)) {
$manager = \Drupal::service('cash');
}
return $manager;
}
// @codingStandardsIgnoreEnd
/**
* Implements hook_library_info_alter().
*/
function cash_library_info_alter(&$libraries, $extension) {
cash()->libraryInfoAlter($libraries, $extension);
}
/**
* Implements hook_library_info_build().
*/
function cash_library_info_build() {
return cash()->libraryInfoBuild();
}
/**
* Implements hook_page_attachments().
*/
function cash_page_attachments(array &$page) {
// Don't add the assets on specified paths, or themes.
if (cash()->isApplicable() && cash()->getSetting('sitewide')) {
$page['#attached']['library'][] = 'cash/cash';
}
}
/**
* Implements hook_help().
*/
function cash_help($route_name) {
if ($route_name == 'help.page.cash') {
$output = file_get_contents(dirname(__FILE__) . '/README.md');
if (function_exists('blazy')) {
$blazy = blazy();
if (method_exists($blazy, 'markdown')) {
return $blazy->markdown($output);
}
}
$func = 'blazy_parse_markdown';
return is_callable($func) ? $func($output) : '<pre>' . $output . '</pre>';
}
return '';
}
