less.admin.inc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @file
  4. * Contains the administration pages for LESS.
  5. *
  6. */
  7. function less_settings($form, &$form_state) {
  8. $form['less_flush'] = array(
  9. '#type' => 'fieldset',
  10. '#collapsible' => FALSE,
  11. '#value' => 'Click this button regenerate all LESS files once.',
  12. );
  13. $form['less_flush']['flush'] = array(
  14. '#type' => 'submit',
  15. '#submit' => array('_flush_less'),
  16. '#value' => 'Flush LESS files',
  17. );
  18. $form['less_devel'] = array(
  19. '#type' => 'checkbox',
  20. '#title' => t('LESS developer mode'),
  21. '#description' => t('Enable the developer mode to ensure LESS files are regenerated every page load, regardless of any change done to the LESS file (which may happen when using the @import notation, and changing only the imported file). Note that this setting does not override "Optimize CSS files" if set via <a href="@performance-url">Performance</a>.', array('@performance-url' => url('admin/config/development/performance'))),
  22. '#default_value' => variable_get('less_devel', FALSE),
  23. );
  24. return system_settings_form($form);
  25. }
  26. function _flush_less($form, &$form_state) {
  27. $less_path = file_default_scheme() . '://less';
  28. file_unmanaged_delete_recursive($less_path);
  29. drupal_set_message(t('LESS files flushed.'), 'status');
  30. }