Same filename in other branches
Handles AdvAgg JS minify installation and upgrade tasks.
Fichier
-
advagg_js_minify/
advagg_js_minify.install
View source
<?php
/**
* @file
* Handles AdvAgg JS minify installation and upgrade tasks.
*/
use Drupal\Core\Url;
/**
* Implements hook_requirements().
*/
function advagg_js_minify_requirements($phase) {
$config = \Drupal::config('advagg_js_minify.settings');
$requirements = [];
// If not at runtime, return here.
if ($phase !== 'runtime') {
return $requirements;
}
// Make sure a minifier is being used.
if ($config->get('minifier') == 0) {
$compression_used = FALSE;
$file_settings = $config->get('file_settings');
if ($file_settings) {
$file_settings = array_column($file_settings, 'path', 'minifier');
unset($file_settings[0]);
if ($file_settings) {
$compression_used = TRUE;
}
}
if (!$compression_used) {
$requirements['advagg_js_minify_not_on'] = [
'title' => t('AdvAgg JS Minify'),
'severity' => REQUIREMENT_WARNING,
'value' => t('AdvAgg JS Minification is disabled.'),
'description' => t('Go to the <a href="@settings">AdvAgg Minify JavaScript settings page</a> and select a minifier, or go to the <a href="@modules">modules page</a> and disable the "AdvAgg Minify Javascript" module.', [
'@settings' => Url::fromRoute('advagg_js_minify.settings')->toString(),
'@modules' => Url::fromRoute('system.modules_list', [], [
'fragment' => 'edit-modules-advanced-cssjs-aggregation',
])->toString(),
]),
];
}
}
return $requirements;
}
Functions
Titre | Deprecated | Résumé |
---|---|---|
advagg_js_minify_requirements | Implements hook_requirements(). |