pace.module in PACE - Page load progress bar 7
Same filename and directory in other branches
Loads PACE js.
File
pace.moduleView source
<?php
/**
* @file
* Loads PACE js.
*/
/**
* Implements hook_permission().
*/
function pace_permission() {
return array(
'manage PACE settings' => array(
'title' => t('Manage PACE settings'),
),
);
}
/**
* Implements hook_menu().
*/
function pace_menu() {
$items = array();
$items['admin/config/user-interface/pace'] = array(
'title' => 'PACE Settings',
'description' => 'Administer PACE progress bar settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'pace_admin_settings_form',
),
'access arguments' => array(
'manage PACE settings',
),
'file' => 'pace.admin.inc',
);
return $items;
}
/**
* Implements template_preprocess_html().
*/
function pace_preprocess_html(&$variables) {
// Check if PACE is disabled for admin pages and don't load it.
if (!variable_get('pace_load_on_admin_enabled')) {
if (!path_is_admin(current_path())) {
load_pace();
}
}
else {
load_pace();
}
}
function load_pace() {
drupal_add_js(drupal_get_path('module', 'pace') . '/js/pace.min.js', array(
'weight' => -100,
'preprocess' => TRUE,
));
drupal_add_css(drupal_get_path('module', 'pace') . '/css/' . variable_get('pace_theme'), array(
'weight' => -100,
'preprocess' => TRUE,
));
if (variable_get('pace_custom_color_enabled')) {
$customcolor = '';
$customcolor .= '.pace .pace-progress {';
$customcolor .= 'background: #';
$customcolor .= variable_get('pace_custom_color_value');
$customcolor .= '; }';
drupal_add_css($customcolor, 'inline');
}
}
Functions
Name | Description |
---|---|
load_pace | |
pace_menu | Implements hook_menu(). |
pace_permission | Implements hook_permission(). |
pace_preprocess_html | Implements template_preprocess_html(). |