You are here

function forward_page_alter in Forward 7.2

Same name and namespace in other branches
  1. 7.3 forward.module \forward_page_alter()

File

./forward.module, line 1012

Code

function forward_page_alter(&$page) {

  // Remove blocks from basic overlay
  if (variable_get('forward_colorbox_enable', 0) && isset($_GET['overlay']) && $_GET['overlay'] != 'cboxnode' && !form_get_errors()) {
    if (isset($page['#type']) && $page['#type'] == 'page' && isset($page['content']['system_main']['#form_id']) && $page['content']['system_main']['#form_id'] == 'forward_form') {
      global $theme;
      $regions = system_region_list($theme);
      foreach ($regions as $key => $region) {
        if (isset($page[$key])) {
          if ($key != 'content') {
            unset($page[$key]);
          }
        }
      }
    }
  }

  // Handle pending AJAX message
  if (isset($_SESSION['forward_message_pending'])) {
    global $user;
    $user = user_load($user->uid);
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));
    }
    else {
      $node = NULL;
    }
    $forward_token = $_SESSION['forward_message_pending'];
    $message = 'Thank you for spreading the word about [site:name].  We appreciate your help.';
    drupal_set_message(token_replace(t(variable_get('forward_thankyou', $message)), array(
      'node' => $node,
      'user' => $user,
      'forward' => $forward_token,
    )), 'status');
    unset($_SESSION['forward_message_pending']);
  }
}