/** * Override or insert variables into the block templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("block" in this case.) */ function zen_preprocess_block(&$vars, $hook) { $block = $vars['block']; // Special classes for blocks. $classes = array('block'); $classes[] = 'block-' . $block->module; $classes[] = 'region-' . $vars['block_zebra']; $classes[] = $vars['zebra']; $classes[] = 'region-count-' . $vars['block_id']; $classes[] = 'count-' . $vars['id']; $vars['edit_links_array'] = array(); $vars['edit_links'] = ''; if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) { include_once './' . _zen_path() . '/template.block-editing.inc'; zen_preprocess_block_editing($vars, $hook); $classes[] = 'with-block-editing'; } // Render block classes. $vars['classes'] = implode(' ', $classes); }
/** * Override or insert variables into the block templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("block" in this case.) */ function zen_preprocess_block(&$vars, $hook) { $block = $vars['block']; // Drupal 7 uses a $content variable instead of $block->content. $vars['content'] = $block->content; // Drupal 7 should use a $title variable instead of $block->subject. $vars['title'] = $block->subject; // Special classes for blocks. $vars['classes_array'][] = 'block-' . $block->module; // Classes describing the position of the block within the region. if ($vars['block_id'] == 1) { $vars['classes_array'][] = 'first'; } if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) { $vars['classes_array'][] = 'last'; } $vars['classes_array'][] = 'region-' . $vars['block_zebra']; $vars['classes_array'][] = $vars['zebra']; $vars['classes_array'][] = 'region-count-' . $vars['block_id']; $vars['classes_array'][] = 'count-' . $vars['id']; // Create the block ID. $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta; $vars['edit_links_array'] = array(); if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) { include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc'; zen_preprocess_block_editing($vars, $hook); $vars['classes_array'][] = 'with-block-editing'; } }
function urbanmediaspace_preprocess_page(&$vars, $hook) { // If the user is silly and enables Zen as the theme, add some styles. if ($GLOBALS['theme'] == 'zen') { include_once './' . _zen_path() . '/zen-internals/template.zen.inc'; _zen_preprocess_page($vars, $hook); } elseif (!module_exists('conditional_styles')) { $vars['styles'] .= $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'], ''); } // Classes for body element. Allows advanced theming based on context // (home page, node of certain type, etc.) // Remove the mostly useless page-ARG0 class. if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-' . drupal_strtolower(arg(0))), $vars['classes_array'])) { unset($vars['classes_array'][$index]); } if (!$vars['is_front']) { // Add unique class for each page. $path = drupal_get_path_alias($_GET['q']); $vars['classes_array'][] = drupal_html_class('page-' . $path); // Add unique class for each website section. list($section, ) = explode('/', $path, 2); if (arg(0) == 'node') { if (arg(1) == 'add') { $section = 'node-add'; } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { $section = 'node-' . arg(2); } } $vars['classes_array'][] = drupal_html_class('section-' . $section); } if (theme_get_setting('zen_wireframes')) { $vars['classes_array'][] = 'with-wireframes'; // Optionally add the wireframes style. } // We need to re-do the $layout and body classes because // template_preprocess_page() assumes sidebars are named 'left' and 'right'. $vars['layout'] = 'none'; if (!empty($vars['sidebar_first'])) { $vars['layout'] = 'first'; } if (!empty($vars['sidebar_second'])) { $vars['layout'] = $vars['layout'] == 'first' ? 'both' : 'second'; } // If the layout is 'none', then template_preprocess_page() will already have // set a 'no-sidebars' class since it won't find a 'left' or 'right' sidebar. if ($vars['layout'] != 'none') { // Remove the incorrect 'no-sidebars' class. if ($index = array_search('no-sidebars', $vars['classes_array'])) { unset($vars['classes_array'][$index]); } // Set the proper layout body classes. if ($vars['layout'] == 'both') { $vars['classes_array'][] = 'two-sidebars'; } else { $vars['classes_array'][] = 'one-sidebar'; $vars['classes_array'][] = 'sidebar-' . $vars['layout']; } } // Store the menu item since it has some useful information. $vars['menu_item'] = menu_get_item(); switch ($vars['menu_item']['page_callback']) { case 'views_page': // Is this a Views page? $vars['classes_array'][] = 'page-views'; break; case 'page_manager_page_execute': // Is this a Panels page? $vars['classes_array'][] = 'page-panels'; break; } $vars['classes'] = implode(' ', $vars['classes_array']); }