diff --git a/advagg.admin.inc b/advagg.admin.inc index fba1814..4e1bbc7 100644 --- a/advagg.admin.inc +++ b/advagg.admin.inc @@ -207,6 +207,12 @@ function advagg_admin_settings_form($form, $form_state) { '#description' => t('All aggregated files can be pre-compressed into a .gz file and served from Apache. This is faster then gzipping the file on each request.'), ); + $form['global']['obscure']['advagg_ajax_render_alter'] = array( + '#type' => 'checkbox', + '#title' => t('Run advagg_ajax_render_alter()'), + '#default_value' => variable_get('advagg_ajax_render_alter', ADVAGG_AJAX_RENDER_ALTER), + '#description' => t('If disabled, AdvAgg will not alter the aggregates returned by ajax requests.'), + ); $form['global']['obscure']['advagg_include_base_url'] = array( '#type' => 'checkbox', '#title' => t('Include the base_url variable in the hooks hash array.'), diff --git a/advagg.module b/advagg.module index 3417641..3387eb9 100644 --- a/advagg.module +++ b/advagg.module @@ -168,6 +168,11 @@ define('ADVAGG_FORCE_HTTPS_PATH', FALSE); */ define('ADVAGG_CSS_IN_JS', FALSE); +/** + * Set to FALSE to not alter the CSS/JS pushed out from AdvAgg. + */ +define('ADVAGG_AJAX_RENDER_ALTER', TRUE); + // Core hook implementations. /** * Inbound URL rewrite helper. @@ -618,6 +623,11 @@ function advagg_ajax_render_alter(&$commands) { return; } + // Do not run hook if advagg_ajax_render_alter is FALSE. + if (!variable_get('advagg_ajax_render_alter', ADVAGG_AJAX_RENDER_ALTER)) { + return; + } + // Conditionally adds the default Drupal/jQuery libraries to the page. // @see http://drupal.org/node/1279226 if (function_exists('drupal_add_js_page_defaults')) {