t('Status message'),
'error' => t('Error message'),
'warning' => t('Warning message'),
);
$status_classes = array(
'status' => 'success',
'error' => 'danger',
'warning' => 'warning',
);
foreach (drupal_get_messages($display) as $type => $messages) {
$output .= "
\n";
$output .= "
";
if (!empty($status_heading[$type])) {
$output .= '
' . $status_heading[$type] . "
\n";
}
if (count($messages) > 1) {
$output .= "
\n";
foreach ($messages as $message) {
$output .= ' - ' . $message . "
\n";
}
$output .= "
\n";
}
else {
$output .= $messages[0];
}
$output .= "
\n";
}
return $output;
}
/**
* Preprocessor for theme('button').
*/
function drupalexp_preprocess_button(&$vars) {
$vars['element']['#attributes']['class'][] = 'btn';
if (isset($vars['element']['#value'])) {
$classes = array(
//specifics
t('Save and add') => 'btn-info',
t('Add another item') => 'btn-info',
t('Add effect') => 'btn-primary',
t('Add and configure') => 'btn-primary',
t('Update style') => 'btn-primary',
t('Download feature') => 'btn-primary',
//generals
t('Save') => 'btn-default',
t('Apply') => 'btn-primary',
t('Create') => 'btn-primary',
t('Confirm') => 'btn-primary',
t('Submit') => 'btn-primary',
t('Export') => 'btn-primary',
t('Import') => 'btn-primary',
t('Restore') => 'btn-primary',
t('Rebuild') => 'btn-primary',
t('Search') => 'btn-primary',
t('Add') => 'btn-info',
t('Update') => 'btn-info',
t('Delete') => 'btn-danger',
t('Remove') => 'btn-danger',
t('Send message') => 'btn-default',
t('Log in') => 'btn-primary',
);
foreach ($classes as $search => $class) {
if (strpos($vars['element']['#value'], $search) !== FALSE) {
$vars['element']['#attributes']['class'][] = $class;
break;
}
}
}
}