Skip to content

Commit

Permalink
Some Hook CSS Alter + Theme Status Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sylus committed Aug 27, 2012
1 parent efd8c01 commit e55c9aa
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions modules/apps/wetkit_web_usability/wetkit_web_usability.module
Expand Up @@ -7,6 +7,100 @@
include_once('wetkit_web_usability.features.inc');
include_once('wetkit_web_usability.menu_wetkit_load.inc');

/**
* Implements hook_css_alter().
*/
function wetkit_web_usability_css_alter(&$css) {
// Installs the jquery.ui themeroller theme to the theme.
if (isset($css['misc/ui/jquery.ui.theme.css']) && user_is_logged_in()) {
$css['misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('module', 'wetkit_core') . '/css/wetkit-jquery-ui-theme.css';
}
else {
unset($css['misc/ui/jquery.ui.theme.css']);
}

if (isset($css['misc/ui/jquery.ui.dialog.css'])) {
unset($css['misc/ui/jquery.ui.dialog.css']);
}

if (isset($css['misc/ui/jquery.ui.tabs.css'])) {
unset($css['misc/ui/jquery.ui.tabs.css']);
}
}

/**
* Implements hook_preprocess_status_messages()
*/
function wetkit_web_usability_preprocess_status_messages(&$variables) {
$variables['theme_hook_suggestions'][] = 'wetkit_status_messages';
}

/**
* Custom Template
*
* Implements WET Messages: Alert, Attention, and General Information
* TODO: Note, Q&A, Tools, Work in Progress, Refer, Summary, Archive
*/
function theme_wetkit_status_messages($variables) {
$display = $variables['display'];
$output = '';

$status_heading = array(
'status' => t('Status message'),
'error' => t('Error message'),
'warning' => t('Warning message'),
);
foreach (drupal_get_messages($display) as $type => $messages) {
$extraclass = '';
$spanclass = (drupal_is_front_page()) ? 'span-8' : 'span-6';
switch ($type)
{
case 'warning':
$extraclass = $spanclass . ' module-alert';
break;
case 'error':
$extraclass = $spanclass . ' module-attention';
break;
case 'status':
$extraclass = $spanclass . ' module-info';
break;
default:
$extraclass = '';
}
$current_path = current_path();
if (path_is_admin($current_path)) {
$extraclass = 'messages';
}
$output .= "<section><div class=\"$extraclass $type\">\n";
if (!empty($status_heading[$type])) {
$output .= '<h3 class="font-xlarge"><span class="color-dark">' . $status_heading[$type] . "</span></h3>\n";
}
if (count($messages) > 1) {
$output .= " <ul>\n";
foreach ($messages as $message) {
$output .= ' <li>' . $message . "</li>\n";
}
$output .= " </ul>\n";
}
else {
$output .= '<ul><li>' . $messages[0] . "</li></ul>\n";
}
$output .= "</div></section><div class=\"clear\"></div>\n";
}
return $output;
}

/**
* Implementation of hook_theme()
*/
function wetkit_web_usability_theme($existing, $type, $theme, $path) {
return array(
'wetkit_status_messages' => array(
'render element' => 'element',
),
);
}

/**
* Implements hook_install().
*/
Expand Down Expand Up @@ -99,6 +193,14 @@ function wetkit_web_usability_libraries_info() {
'cols' => 100,
),
'files' => array(
'css' => array(
'build/grids/css/util-ie-min.css' => array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE, 'weight' => 5),
'build/grids/css/util-min.css' => array('preprocess' => FALSE, 'weight' => 5),
'build/js/css/pe-ap-ie-min.css' => array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE, 'weight' => 5),
'build/js/css/pe-ap-min.css' => array('preprocess' => FALSE, 'weight' => 5),
'build/theme-gcwu-fegc/css/theme-ie-min.css' => array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE, 'weight' => 5),
'build/theme-gcwu-fegc/css/theme-min.css' => array('preprocess' => FALSE, 'weight' => 5),
),
'js' => array(
'build/theme-gcwu-fegc/js/theme-min.js' => array('scope' => 'footer', 'weight' => 5),
'build/js/settings.js' => array('scope' => 'footer', 'weight' => 5),
Expand Down Expand Up @@ -128,6 +230,9 @@ function wetkit_web_usability_libraries_info() {
return $libraries;
}

/**
* Implements wetkit_web_usability_check_variant().
*/
function wetkit_web_usability_check_variant($libary, $variant) {
if ((variable_get('wetkit_web_usability_dev', 0) == 1)) {
return TRUE;
Expand Down

0 comments on commit e55c9aa

Please sign in to comment.