You are here

function minifyjs_form_system_performance_settings_alter in Minify JS 7

Same name and namespace in other branches
  1. 8.2 minifyjs.module \minifyjs_form_system_performance_settings_alter()
  2. 8 minifyjs.module \minifyjs_form_system_performance_settings_alter()

Implements hook_FORM_ID_alter().

_state

Parameters

type $form:

File

./minifyjs.module, line 75

Code

function minifyjs_form_system_performance_settings_alter(&$form, &$form_state, $form_id) {
  if (user_access('administer minifyjs')) {

    // Determine the number of files minified.
    $files = minifyjs_load_all_files();
    $files_minified = 0;
    foreach ($files as $file) {
      if (!empty($file->minified_uri)) {
        $files_minified++;
      }
    }
    $form['bandwidth_optimization']['minifyjs_use_minified_javascript'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use Minified JavaScript files.'),
      '#disabled' => $files_minified ? FALSE : TRUE,
      '#description' => t('Toggle minified javascript files on or off. There are %minified minified files out of %total total files available. !click.', array(
        '%minified' => $files_minified,
        '%total' => count($files),
        '!click' => l(t('Click here to manage your javascript files.'), 'admin/config/development/performance/js'),
      )),
      '#default_value' => variable_get('minifyjs_use_minified_javascript', 0),
    );
  }
}