You are here

function supersized_page_alter in Supersized 7

Same name and namespace in other branches
  1. 8 supersized.module \supersized_page_alter()

Implements hook_page_alter().

File

./supersized.module, line 382
Supersized module file.

Code

function supersized_page_alter(&$page) {
  $node = NULL;
  $plugin = NULL;
  if (module_exists('context')) {

    // Check disable context reaction.
    $plugin = context_get_plugin('reaction', 'supersized_disable_context');
    if (is_object($plugin) && $plugin
      ->execute()) {
      return;
    }

    // Try to see if there's any supersized set by context.
    $plugin = context_get_plugin('reaction', 'supersized_context');
    if (is_object($plugin)) {
      $node = node_load($plugin
        ->execute());
    }
  }

  // If there's a node defined, try to run supersized.
  if (empty($node)) {
    $node = menu_get_object();
  }
  if (!empty($node)) {
    supersized_run_supersized($node, $page);
  }
}