advagg_bundler.admin.inc

  1. cis7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  2. cle7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  3. ecd7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  4. elmsmedia7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  5. harmony7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  6. icor7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  7. meedjum_blog7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
  8. mooc7 sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc

Admin page callbacks for the advagg bundler module.

Functions

Namesort descending Description
advagg_bundler_admin_settings_form Form builder; Configure advagg settings.
advagg_bundler_admin_settings_form_submit Clear out the advagg cache bin when the save configuration button is pressed.

File

sites/all/modules/ulmus/advagg/advagg_bundler/advagg_bundler.admin.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Admin page callbacks for the advagg bundler module.
  5. */
  6. /**
  7. * Form builder; Configure advagg settings.
  8. *
  9. * @ingroup forms
  10. * @see system_settings_form()
  11. */
  12. function advagg_bundler_admin_settings_form() {
  13. drupal_set_title(t('AdvAgg: Bundler'));
  14. $form = array();
  15. $form['advagg_bundler_active'] = array(
  16. '#type' => 'checkbox',
  17. '#title' => t('Bundler is Active'),
  18. '#default_value' => variable_get('advagg_bundler_active', ADVAGG_BUNDLER_ACTIVE),
  19. '#description' => t('If not checked, the bundler will passively monitor your site, but it will not split up aggregates.'),
  20. );
  21. $options = array(
  22. 0 => 0,
  23. 1 => 1,
  24. 2 => 2,
  25. 3 => 3,
  26. 4 => 4,
  27. 5 => 5,
  28. 6 => 6,
  29. 7 => 7,
  30. 8 => 8,
  31. 9 => 9,
  32. 10 => 10,
  33. 11 => 11,
  34. 12 => 12,
  35. 13 => 13,
  36. 14 => 14,
  37. 15 => 15,
  38. );
  39. $form['advagg_bundler_max_css'] = array(
  40. '#type' => 'select',
  41. '#title' => t('Target Number Of CSS Bundles Per Page'),
  42. '#default_value' => variable_get('advagg_bundler_max_css', ADVAGG_BUNDLER_MAX_CSS),
  43. '#options' => $options,
  44. '#description' => t('If 0 is selected then the bundler is disabled'),
  45. '#states' => array(
  46. 'disabled' => array(
  47. '#edit-advagg-bundler-active' => array('checked' => FALSE),
  48. ),
  49. ),
  50. );
  51. $form['advagg_bundler_max_js'] = array(
  52. '#type' => 'select',
  53. '#title' => t('Target Number Of JS Bundles Per Page'),
  54. '#default_value' => variable_get('advagg_bundler_max_js', ADVAGG_BUNDLER_MAX_JS),
  55. '#options' => $options,
  56. '#description' => t('If 0 is selected then the bundler is disabled'),
  57. '#states' => array(
  58. 'disabled' => array(
  59. '#edit-advagg-bundler-active' => array('checked' => FALSE),
  60. ),
  61. ),
  62. );
  63. $form['info'] = array(
  64. '#type' => 'fieldset',
  65. '#collapsible' => TRUE,
  66. '#collapsed' => TRUE,
  67. '#title' => t('Raw Grouping Info'),
  68. );
  69. module_load_include('inc', 'advagg', 'advagg.admin');
  70. $analysis = advagg_bundler_analysis('', TRUE);
  71. $rawtext = print_r($analysis, TRUE);
  72. $form['info']['advagg_bundler_info'] = array(
  73. '#type' => 'textarea',
  74. '#title' => t('%count different groupings', array('%count' => count($analysis))),
  75. '#default_value' => $rawtext,
  76. '#rows' => 30,
  77. );
  78. // Clear the cache bins on submit.
  79. $form['#submit'][] = 'advagg_bundler_admin_settings_form_submit';
  80. return system_settings_form($form);
  81. }
  82. // Submit callback.
  83. /**
  84. * Clear out the advagg cache bin when the save configuration button is pressed.
  85. */
  86. function advagg_bundler_admin_settings_form_submit($form, &$form_state) {
  87. $cache_bins = advagg_flush_caches();
  88. foreach ($cache_bins as $bin) {
  89. cache_clear_all('*', $bin, TRUE);
  90. }
  91. }