
/** * Implements hook_theme_registry_alter(). */ function module_theme_registry_alter(&$theme_registry) { $theme_registry['status_messages']['function'] = '_module_status_messages'; } /** * Custom theme function that overrides * theme('status_messages'). */ function _module_status_messages($variables) { global $theme; if($theme != 'theme_machine_name'){ // allow alert-boxes only in zurb theme return theme_status_messages($variables); } $display = $variables['display']; $output = ''; $status_heading = array( 'status' => t('Status message'), 'error' => t('Error message'), 'warning' => t('Warning message'), ); // translate drupal core message types to zurb types $zurb_types = array( 'status' => 'success', 'warning' => 'warning', 'info' => 'info', 'error' => 'alert', 'secondary' => 'secondary', ); foreach (drupal_get_messages($display) as $type => $messages) { $output .= '<div data-alert class="alert-box ' . $zurb_types[$type] . ' radius">'; if (count($messages) > 1) { $output .= " <ul>\n"; foreach ($messages as $message) { $output .= ' <li>' . $message . "</li>\n"; } $output .= " </ul>\n"; } else { $output .= $messages[0]; } $output .= '<a href="#" class="close">×</a>'; $output .= "</div>\n"; } return $output; }
Neuen Kommentar hinzufügen