Exemplo n.º 1
0
/**
 * Override or insert variables into the maintenance page template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("maintenance_page" in this case.)
 */
function zen_preprocess_maintenance_page(&$vars, $hook)
{
    // If Zen is the maintenance 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.)
    $vars['body_classes_array'] = explode(' ', $vars['body_classes']);
}
Exemplo n.º 2
0
/**
 * Override or insert variables into the maintenance page template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("maintenance_page" in this case.)
 */
function zen_preprocess_maintenance_page(&$vars, $hook)
{
    // If Zen is the maintenance 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')) {
        $language = $GLOBALS['language']->direction == LANGUAGE_RTL ? '_rtl' : '';
        $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'] . $language, '');
        $vars['styles'] .= $vars['conditional_styles'];
    }
}
Exemplo n.º 3
0
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']);
}