pace.module in PACE - Page load progress bar 2.0.x
Same filename and directory in other branches
Loads PACE js.
File
pace.moduleView source
<?php
/**
* @file
* Loads PACE js.
*/
use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
/**
* Implements template_preprocess_html().
*/
function pace_preprocess_html(&$variables) {
// Check if PACE is disabled for admin pages and don't load it.
if (!\Drupal::config('pace.settings')
->get('pace_load_on_admin_enabled')) {
$is_admin = \Drupal::service('router.admin_context')
->isAdminRoute();
if (!$is_admin) {
load_pace($variables);
}
}
else {
load_pace($variables);
}
}
function load_pace(&$variables) {
$variables['#attached']['library'][] = 'pace/pace';
$variables['#attached']['library'][] = 'pace/' . \Drupal::config('pace.settings')
->get('pace_color') . '-' . \Drupal::config('pace.settings')
->get('pace_theme');
}
Functions
Name | Description |
---|---|
load_pace | |
pace_preprocess_html | Implements template_preprocess_html(). |