advagg_css_minify.install in Advanced CSS/JS Aggregation 8.3
Same filename and directory in other branches
Handles AdvAgg CSS minify installation and upgrade tasks.
File
advagg_css_minify/advagg_css_minify.installView source
<?php
/**
* @file
* Handles AdvAgg CSS minify installation and upgrade tasks.
*/
use Drupal\Core\Url;
/**
* Implements hook_requirements().
*/
function advagg_css_minify_requirements($phase) {
$config = \Drupal::config('advagg_css_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) {
$requirements['advagg_css_minify_not_on'] = [
'title' => t('AdvAgg CSS Minify'),
'severity' => REQUIREMENT_WARNING,
'value' => t('AdvAgg CSS Minification is disabled.'),
'description' => t('Go to the <a href="@settings">AdvAgg Minify CSS settings page</a> and select a minifier, or go to the <a href="@modules">modules page</a> and disable the "AdvAgg Minify CSS" module.', [
'@settings' => Url::fromRoute('advagg_css_minify.settings')
->toString(),
'@modules' => Url::fromRoute('system.modules_list', [], [
'fragment' => 'edit-modules-advanced-cssjs-aggregation',
])
->toString(),
]),
];
}
return $requirements;
}
/**
* Implements hook_install().
*
* Clear some caches.
*/
function advagg_css_minify_install() {
\Drupal::cache('render')
->invalidateAll();
\Drupal::cache('advagg')
->invalidateAll();
}
Functions
Name | Description |
---|---|
advagg_css_minify_install | Implements hook_install(). |
advagg_css_minify_requirements | Implements hook_requirements(). |