Same filename in other branches
  1. 5.0.x advagg_css_minify/advagg_css_minify.install
  2. 6.0.x advagg_css_minify/advagg_css_minify.install
  3. 8.x-3.x advagg_css_minify/advagg_css_minify.install
  4. 8.x-4.x advagg_css_minify/advagg_css_minify.install

Handles AdvAgg CSS Minify installation and upgrade tasks.

File

advagg_css_minify/advagg_css_minify.install

View 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) {
        $active = 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) {
                $active = TRUE;
            }
        }
        if (!$active) {
            $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 CSS Minify settings page</a> and select a minifier, or go to the <a href="@modules">modules page</a> and disable the "AdvAgg CSS Minify" module.', [
                    '@settings' => Url::fromRoute('advagg_css_minify.settings')->toString(),
                    '@modules' => Url::fromRoute('system.modules_list', [], [
                        'fragment' => 'edit-modules-advanced-cssjs-aggregation',
                    ])->toString(),
                ]),
            ];
        }
    }
    return $requirements;
}

Functions

Title Deprecated Summary
advagg_css_minify_requirements Implements hook_requirements().