function adaptivetheme_page_alter

cis7 alter.inc adaptivetheme_page_alter(&$page)
cle7 alter.inc adaptivetheme_page_alter(&$page)
elmsmedia7 alter.inc adaptivetheme_page_alter(&$page)
icor7 alter.inc adaptivetheme_page_alter(&$page)
meedjum_blog7 alter.inc adaptivetheme_page_alter(&$page)
mooc7 alter.inc adaptivetheme_page_alter(&$page)

hook_page_alter()

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc, line 285
General alters.

Code

function adaptivetheme_page_alter(&$page) {
  global $theme_key;
  $theme_name = $theme_key;

  // Get the menu item
  $menu_item = menu_get_item();

  // Theme taxonomy term pages sensibly, remove redundant and potentially empty
  // markup and wrap the node list in section elements with a class for theming.
  if ($menu_item['tab_root'] == 'taxonomy/term/%') {
    unset($page['content']['system_main']['term_heading']['#prefix']);
    unset($page['content']['system_main']['term_heading']['#suffix']);
    $page['content']['system_main']['nodes']['#prefix'] = '<section class="nodes">';
    $page['content']['system_main']['nodes']['#suffix'] = '</section>';
  }

  if (at_get_setting('enable_extensions', $theme_name) === 1) {
    if (at_get_setting('enable_markup_overides', $theme_name) === 1) {
      // Remove block system main, just from the front page
      if (drupal_is_front_page()) {
        if (at_get_setting('unset_block_system_main_front', $theme_name) === 1) {
          $page['content']['system_main']['#access'] = FALSE; // Brutal but effective
        }
      }
    }
  }

  // Get all the regions with blocks
  $block_regions = &drupal_static(__FUNCTION__, array());

  if (empty($blocks_regions)) {
    $block_regions = system_region_list($GLOBALS['theme'], REGIONS_VISIBLE);
  }

  // Setup the detection environment
  $detection = variable_get('at_detection', 0);
  if ($detection == 1) {
    $browscap_detect = variable_get('at_browscap_detect', 0);
    $mobile_detect = variable_get('at_mobile_detect', 0);
    $browser = at_get_browser();
    $page['is_mobile'] = $browser['is_mobile'];
    $page['is_tablet'] = $browser['is_tablet'];
  }
  else {
    $page['is_mobile'] = FALSE;
    $page['is_tablet'] = FALSE;
  }

  // Look in each visible region for blocks
  foreach ($block_regions as $region => $name) {
    if (!empty($page[$region])) {

      // Find the last block in the region
      $blocks = array_reverse(element_children($page[$region]));
      while ($blocks && !isset($page[$region][$blocks[0]]['#block'])) {
        array_shift($blocks);
      }

      if ($blocks) {

        // Set a bool for the last class for blocks feature
        $page[$region][$blocks[0]]['#block']->last_in_region = TRUE;

        // Alter regions and block visibility. Note that ideally this would all
        // be better in hook_page_build(), however themes can't fire that hook.
        if (at_get_setting('enable_extensions', $theme_name) === 1) {
          if (at_get_setting('enable_context_regions') === 1) {

            // UNSET
            if (at_get_setting('unset_' . $region) === 1) {
              if (at_get_setting('unset_options_' . $region) == 'unset_smalltouch') {
                if ($page['is_mobile'] === TRUE && $page['is_tablet'] === FALSE) {
                  unset($page[$region]);
                }
              }
              else {
                // this is the all option
                if ($page['is_mobile'] === TRUE) {
                  unset($page[$region]);
                }
              }
            }

            // MOVE
            if (at_get_setting('move_region_' . $region) === 1) {
              if (at_get_setting('move_options_' . $region) == 'move_smalltouch') {
                if ($page['is_mobile'] === TRUE && $page['is_tablet'] === FALSE) {
                  $page = at_move_regions($page, $region, $blocks);
                }
              }
              else {
                // this is the all option
                if ($page['is_mobile'] === TRUE) {
                  $page = at_move_regions($page, $region, $blocks);
                }
              }
            }
          }
        }
      }
    }
  }

  // Run the panels test
  if (theme_get_setting('load_all_panels') === 1) {
    if (drupal_is_front_page()) {
      $page['content']['#markup'] = at_debug_panels();
      if (theme_get_setting('load_all_panels_no_sidebars') === 1) {
        unset($page['sidebar_first']);
        unset($page['sidebar_second']);
      }
    }
  }

  //kpr($page);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.