You are here

function better_messages_preprocess_page in Better Messages 6.2

Same name and namespace in other branches
  1. 6 better_messages.module \better_messages_preprocess_page()
  2. 7 better_messages.module \better_messages_preprocess_page()

File

./better_messages.module, line 114

Code

function better_messages_preprocess_page(&$vars) {
  if ($vars['messages']) {
    $settings = better_messages_get_settings();

    // Check if path Better Messages is enabled for this path
    $better_messages = better_messages_process_visibility();
    $access = user_access('access better messages');
    if ($better_messages && $access) {
      $message = $vars['messages'];

      // Here comes the graceful degrade for browsers with JS disabled
      $vars['messages'] = "<noscript>\n" . $_SESSION['original_messages'] . "\n</noscript>\n";
      unset($_SESSION['original_messages']);
      $vars['closure'] .= $message;
    }
  }
}