You are here

function advagg_bundler_admin_settings_form in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg_bundler/advagg_bundler.admin.inc \advagg_bundler_admin_settings_form()
  2. 7.2 advagg_bundler/advagg_bundler.admin.inc \advagg_bundler_admin_settings_form()

Form builder; Configure advagg settings.

See also

system_settings_form()

1 string reference to 'advagg_bundler_admin_settings_form'
advagg_bundler_admin_page in advagg_bundler/advagg_bundler.admin.inc
Page generation function for admin/settings/bundler

File

advagg_bundler/advagg_bundler.admin.inc, line 22
Admin page callbacks for the advagg bundler module.

Code

function advagg_bundler_admin_settings_form($form) {
  $form = array();
  $form['advagg_bundler_active'] = array(
    '#type' => 'checkbox',
    '#title' => t('Bundler is Active'),
    '#default_value' => variable_get('advagg_bundler_active', ADVAGG_BUNDLER_ACTIVE),
    '#description' => t('If not checked, the bundler will passively monitor your site, but it will not split up aggregates.'),
  );
  $options = array(
    0 => 0,
    1 => 1,
    2 => 2,
    3 => 3,
    4 => 4,
    5 => 5,
    6 => 6,
    7 => 7,
    8 => 8,
    9 => 9,
    10 => 10,
  );
  $form['advagg_bundler_max_css'] = array(
    '#type' => 'select',
    '#title' => t('Max Number Of CSS Bundles Per Page'),
    '#default_value' => variable_get('advagg_bundler_max_css', ADVAGG_BUNDLER_MAX_CSS),
    '#options' => $options,
    '#description' => t('If 0 is selected then the bundler is disabled'),
  );
  $form['advagg_bundler_max_js'] = array(
    '#type' => 'select',
    '#title' => t('Max Number Of JS Bundles Per Page'),
    '#default_value' => variable_get('advagg_bundler_max_js', ADVAGG_BUNDLER_MAX_JS),
    '#options' => $options,
    '#description' => t('If 0 is selected then the bundler is disabled'),
  );
  $form['info'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Raw Grouping Info'),
  );
  module_load_include('inc', 'advagg', 'advagg.admin');
  $analysis = advagg_bundler_analysis('', TRUE);
  asort($analysis);
  $analysis = array_reverse($analysis);
  $data = array();
  foreach ($analysis as $filename => $key) {
    $data[$key][] = $filename;
  }
  list($rawtext, $rows) = advagg_form_print_r($data);
  $form['info']['advagg_bundler_info'] = array(
    '#type' => 'textarea',
    '#title' => t('%count different groupings', array(
      '%count' => count($data),
    )),
    '#default_value' => $rawtext,
    '#rows' => $rows - 1,
  );
  return system_settings_form($form);
}