function pagestyle_block_view in Page Style 7
Implement hook_block_view().
File
- ./
pagestyle.module, line 104 - Display a style changer on the page and in the browser menu for a better web accessibility.
Code
function pagestyle_block_view($delta = '') {
$pagestyle_cookie_expires = pagestyle_cookie_expires($mode = 'php');
$pagestyle_cookie_domain = variable_get('pagestyle_cookie_domain', base_path());
if (user_access('access pagestyle content')) {
$block_title = pagestyle_block_title($title = 'title');
$pagestyle_current_text = variable_get('pagestyle_display_current_pagestyle', 'display');
$pagestyle_normal = variable_get('pagestyle_normal', 'standard');
$pagestyle_block_type = variable_get('pagestyle_block_type', 'text');
$pagestyle_javascript = variable_get('pagestyle_javascript', 1);
$block_content = theme('pagestyle_text');
switch ($pagestyle_block_type) {
case 'text':
$block_content = theme('pagestyle_text');
break;
case 'image':
$block_content = theme('pagestyle_image');
break;
case 'select':
$block_content = drupal_get_form('pagestyle_form');
break;
default:
$block_content = theme('pagestyle_text');
}
if (!isset($_COOKIE['pagestyle']) && _pagestyle_set_session()) {
setcookie("pagestyle", $pagestyle_normal, time() + $pagestyle_cookie_expires, $pagestyle_cookie_domain, "");
}
$block['content'] = $block_content;
if ($pagestyle_javascript == 0 || $pagestyle_javascript == 1) {
if (!isset($_SESSION['pagestyle']) && _pagestyle_set_session()) {
$_SESSION['pagestyle'] = $pagestyle_normal;
}
}
$block['subject'] = $block_title;
$block['content'] = $block_content;
return $block;
}
}