You are here

function themekey_debug_page_alter in ThemeKey 7.3

Same name and namespace in other branches
  1. 7 themekey_debug.module \themekey_debug_page_alter()
  2. 7.2 themekey_debug.module \themekey_debug_page_alter()

Implements hook_page_alter().

Prints out debug messages at the end of the page.

Return value

string

File

./themekey_debug.module, line 168
Provides a debug mode for module ThemeKey.

Code

function themekey_debug_page_alter(&$page) {
  if (variable_get('themekey_debug_show_property_values', FALSE)) {

    // add the properties to the end of debug messages
    themekey_debug_properties();
  }
  if (variable_get('themekey_css_debug_css_files', FALSE)) {

    // add the list of css files to the end of debug messages.
    $list['title'] = t('Css files on a page');
    $list['items'] = array_filter(explode("\n", drupal_get_css()), 'themekey_debug_filter_css_array');
    themekey_set_debug_message(theme('item_list', $list));
  }
  if ($messages = themekey_set_debug_message('flush')) {
    $page['page_bottom']['themekey'] = array(
      '#type' => 'markup',
      '#markup' => $messages,
    );

    // Avoid caching of pages containing debug info in internal page cache
    drupal_page_is_cacheable(FALSE);

    // ... and external caches like varnish, boost, ...
    drupal_add_http_header('Status', '503 Service unavailable');
  }
}