function pagestyle_print_html in Page Style 7
Same name and namespace in other branches
- 5 pagestyle.module \pagestyle_print_html()
- 6 pagestyle.module \pagestyle_print_html()
Print HTMl code in the head
1 call to pagestyle_print_html()
- pagestyle_page_build in ./
pagestyle.module - Implement hook_page_build().
File
- ./
pagestyle.module, line 253 - Display a style changer on the page and in the browser menu for a better web accessibility.
Code
function pagestyle_print_html() {
$uri = drupal_get_path('module', 'pagestyle');
$pagestyle_current = pagestyle_get_current($value = 'int');
$pagestyle_browser_style_switcher = variable_get('pagestyle_browser_style_switcher', 0);
$pagestyle_black_white = variable_get('pagestyle_black_white', 1);
$pagestyle_white_black = variable_get('pagestyle_white_black', 1);
$pagestyle_yellow_blue = variable_get('pagestyle_yellow_blue', 1);
$pagestyle_standard = variable_get('pagestyle_standard', 1);
$pagestyle_fontweight_black_white = variable_get('pagestyle_fontweight_black_white', 'normal');
$pagestyle_fontweight_white_black = variable_get('pagestyle_fontweight_white_black', 'bold');
$pagestyle_fontweight_yellow_blue = variable_get('pagestyle_fontweight_yellow_blue', 'bold');
$pagestyle_head = "";
$pagestyle = array(
'black_white' => t('Black') . '/' . t('White'),
'white_black' => t('White') . '/' . t('Black'),
'yellow_blue' => t('Yellow') . '/' . t('Blue'),
'standard' => t('Standard'),
);
switch ($pagestyle_current) {
case "black_white":
$pagestyle_rel = array(
'standard' => 'alternate ',
'black_white' => '',
'white_black' => 'alternate ',
'yellow_blue' => 'alternate ',
);
break;
case "white_black":
$pagestyle_rel = array(
'standard' => 'alternate ',
'black_white' => 'alternate ',
'white_black' => '',
'yellow_blue' => 'alternate ',
);
break;
case "yellow_blue":
$pagestyle_rel = array(
'standard' => 'alternate ',
'black_white' => 'alternate ',
'white_black' => 'alternate ',
'yellow_blue' => '',
);
break;
case "standard":
$pagestyle_rel = array(
'standard' => '',
'black_white' => 'alternate ',
'white_black' => 'alternate ',
'yellow_blue' => 'alternate ',
);
break;
default:
$pagestyle_rel = array(
'standard' => '',
'black_white' => 'alternate ',
'white_black' => 'alternate ',
'yellow_blue' => 'alternate ',
);
}
$attributes_black_white = array(
'class' => array(
'ps_black_white',
),
'rel' => $pagestyle_rel['black_white'] . 'stylesheet',
'type' => 'text/css',
'media' => 'screen',
'title' => $pagestyle['black_white'],
'href' => $uri . '/css/style_black_white.css',
'class' => 'ps_black_white',
);
$attributes_white_black = array(
'class' => array(
'ps_white_black',
),
'rel' => $pagestyle_rel['white_black'] . 'stylesheet',
'type' => 'text/css',
'media' => 'screen',
'title' => $pagestyle['white_black'],
'href' => $uri . '/css/style_white_black.css',
'class' => 'ps_white_black',
);
$attributes_yellow_blue = array(
'class' => array(
'ps_yellow_blue',
),
'rel' => $pagestyle_rel['yellow_blue'] . 'stylesheet',
'type' => 'text/css',
'media' => 'screen',
'title' => $pagestyle['yellow_blue'],
'href' => $uri . '/css/style_yellow_blue.css',
'class' => 'ps_yellow_blue',
);
$attributes_standard = array(
'class' => array(
'ps_standard',
),
'rel' => $pagestyle_rel['standard'] . 'stylesheet',
'type' => 'text/css',
'media' => 'screen',
'title' => $pagestyle['standard'],
'href' => $uri . '/css/style_standard.css',
'class' => 'ps_standard',
);
if ($pagestyle_browser_style_switcher == 1) {
if ($pagestyle_black_white == 1) {
drupal_add_html_head_link($attributes_black_white, $header = FALSE);
}
if ($pagestyle_white_black == 1) {
drupal_add_html_head_link($attributes_white_black, $header = FALSE);
}
if ($pagestyle_yellow_blue == 1) {
drupal_add_html_head_link($attributes_yellow_blue, $header = FALSE);
}
if ($pagestyle_standard == 1) {
drupal_add_html_head_link($attributes_standard, $header = FALSE);
}
}
// font-weight
// font-weight class style for jQuery
$pagestyle_head .= 'body.pagestyle_black_white, body.pagestyle_black_white * { font-weight: ' . $pagestyle_fontweight_black_white . ' !important; }' . "\n";
$pagestyle_head .= 'body.pagestyle_white_black, body.pagestyle_white_black * { font-weight: ' . $pagestyle_fontweight_white_black . ' !important; }' . "\n";
$pagestyle_head .= 'body.pagestyle_yellow_blue, body.pagestyle_yellow_blue * { font-weight: ' . $pagestyle_fontweight_yellow_blue . ' !important; }' . "\n";
// admin
if (user_access('administer pagestyle') && $_GET['q'] == 'admin/config/content/pagestyle') {
$pagestyle_head .= 'div.form-item-pagestyle-black-white label.option, div.form-item-pagestyle-fontweight-black-white label { font-weight: ' . $pagestyle_fontweight_black_white . '; }' . "\n";
$pagestyle_head .= 'div.form-item-pagestyle-white-black label.option, div.form-item-pagestyle-fontweight-white-black label { font-weight: ' . $pagestyle_fontweight_white_black . '; }' . "\n";
$pagestyle_head .= 'div.form-item-pagestyle-yellow-blue label.option, div.form-item-pagestyle-fontweight-yellow-blue label { font-weight: ' . $pagestyle_fontweight_yellow_blue . '; }' . "\n";
}
// 'media' => 'screen, projection, tty, tv, print'
if (!pagestyle_admin_theme_check()) {
drupal_add_css($pagestyle_head, $options = array(
'type' => 'inline',
'media' => 'screen',
));
}
}