t('Better Messages settings'), 'description' => t('Better handling of Drupal messages UI'), 'page callback' => 'drupal_get_form', 'page arguments' => array('better_messages_admin'), 'access callback' => 'user_access', 'access arguments' => array('administer better messages'), 'file' => 'better_messages.inc', ); return $items; } /** * Implementation of hook_perm(). */ function better_messages_perm() { return array('access better messages', 'administer better messages'); } /* Implementation of hook_theme */ function better_messages_theme() { return array( 'better_messages_content' => array( 'arguments' => array('display' => null), ), 'better_messages' => array( 'template' => 'better_messages', 'arguments' => array('content' => null), ), ); } /* Implementation of hook_theme_registry_alter to add better_messages theme function */ function better_messages_theme_registry_alter(&$theme_registry) { $theme_registry['status_messages']['function'] = "theme_better_messages"; } function theme_better_messages($display = NULL) { $output = ''; $better_messages = better_messages_process_visibility(); $access = user_access('access better messages'); $message = drupal_get_messages($display, false); if ($better_messages && $access && !empty($message)) { $disable_autoclose = array_key_exists('error', $message); better_messages_add_files($disable_autoclose); $message = theme('better_messages_content', $display); // We save the intial output to SESSION so we can put it in