You are here

function advagg_form_system_performance_settings_alter in Advanced CSS/JS Aggregation 8.2

Same name and namespace in other branches
  1. 8.4 advagg.module \advagg_form_system_performance_settings_alter()
  2. 8.3 advagg.module \advagg_form_system_performance_settings_alter()
  3. 7.2 advagg.module \advagg_form_system_performance_settings_alter()
  4. 7 advagg.module \advagg_form_system_performance_settings_alter()

Implements hook_form_FORM_ID_alter().

Give advice on how to temporarily disable css/js aggregation.

File

./advagg.module, line 283
Advanced CSS/JS aggregation module.

Code

function advagg_form_system_performance_settings_alter(&$form, &$form_state) {
  $msg = t('NOTE: If you wish to bypass aggregation for a set amount of time, you can go to the <a href="@operations">AdvAgg operations</a> page and press the "aggregation bypass cookie" button.', [
    '@operations' => Url::fromRoute('advagg.operations')
      ->toString(),
  ]);
  if (\Drupal::currentUser()
    ->hasPermission('bypass advanced aggregation')) {
    $msg .= t('You can also selectively bypass aggregation by adding <code>@code</code> to the URL of any page.', [
      '@code' => '?advagg=0',
    ]);
  }
  else {
    $msg .= t('You do not have the <a href="@permission">bypass advanced aggregation permission</a> so adding <code>@code</code> to the URL will not work at this time for you; either grant this permission to your user role or use the bypass cookie if you wish to selectively bypass aggregation.', [
      '@permission' => Url::fromRoute('user.admin_permissions')
        ->toString(),
      '@code' => '?advagg=0',
    ]);
  }
  $form['bandwidth_optimization']['advagg_note'] = [
    '#markup' => $msg,
  ];
}