You are here

function forward_page_alter in Forward 7.3

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

Implements hook_page_alter().

File

./forward.module, line 997
Allows forwarding of entities by email, and provides a record of how often each has been forwarded.

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;
    $account = user_load($user->uid);
    $token = $_SESSION['forward_message_pending'];
    $token['user'] = $account;
    $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)), $token), 'status');
    unset($_SESSION['forward_message_pending']);
  }
}