You are here

at_tools.module in AT Tools 7

Same filename and directory in other branches
  1. 8.3 at_tools.module
  2. 8 at_tools.module
  3. 8.2 at_tools.module

File

at_tools.module
View source
<?php

// Rebuild responsive CSS files when the cache is cleared.
// For more background, see https://drupal.org/node/1995938
function at_tools_flush_caches() {
  if (variable_get('preprocess_css', '') == 1) {

    // Nicked strait from commons_install() with mods to get
    // all enabled AT subthemes since we don't know which ones to clear.
    $themes_array = array(
      'adaptivetheme',
    );
    $themes = list_themes(TRUE);
    foreach ($themes as $key => $theme_name) {
      if ($key == 'adaptivetheme') {
        foreach ($theme_name->sub_themes as $sub_theme_key => $sub_theme_name) {
          $array[] = $sub_theme_key;
        }
      }
      foreach ($array as $name) {
        if ($name == $key) {
          if ($theme_name->status == 1) {
            $themes_array[] = $key;
          }
        }
      }
    }
    module_load_include('inc', 'system', 'system.admin');
    foreach ($themes_array as $theme_name) {
      $form_state = form_state_defaults();
      $form_state['build_info']['args'][0] = $theme_name;
      $form_state['values'] = array();
      drupal_form_submit('system_theme_settings', $form_state);
    }
  }
}

Functions