Ejemplo n.º 1
0
/**
 * Prepares variables for page.tpl.php
 */
function borg_preprocess_page(&$variables)
{
    // Add the Source Sans Pro font.
    backdrop_add_css('https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700', array('type' => 'external'));
    // Add FontAwesome.
    backdrop_add_css('https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array('type' => 'external'));
    // Add Flexslider to the front page only.
    if (backdrop_is_front_page()) {
        $path = backdrop_get_path('theme', 'borg');
        backdrop_add_css($path . '/css/flexslider.css');
        backdrop_add_js($path . '/js/jquery.flexslider.js');
        $script = "\n\$(window).load(function() {\n  \$('.flexslider').flexslider();\n});";
        backdrop_add_js($script, array('type' => 'inline'));
    }
    $node = menu_get_object();
    if (isset($node) && isset($node->type) && $node->type === 'book') {
        $variables['classes'][] = 'drawer-open';
        $variables['classes'][] = 'layout-both-sidebars';
    } else {
        $variables['classes'][] = 'drawer-closed';
        $array_key = array_search('layout-both-sidebars', $variables['classes']);
        if ($array_key !== FALSE) {
            $variables['classes'][$array_key] = 'layout-one-sidebar';
        }
    }
}
Ejemplo n.º 2
0
/**
 * Perform setup tasks for non-cached page requests.
 *
 * This hook is run at the beginning of the page request. It is typically
 * used to set up global parameters that are needed later in the request.
 * When this hook is called, the theme and all modules are already loaded in
 * memory.
 *
 * This hook is not run on cached pages.
 *
 * To add CSS or JS that should be present on all pages, modules should not
 * implement this hook, but declare these files in their .info file.
 *
 * @see hook_boot()
 */
function hook_init()
{
    // Since this file should only be loaded on the front page, it cannot be
    // declared in the info file.
    if (backdrop_is_front_page()) {
        backdrop_add_css(backdrop_get_path('module', 'foo') . '/foo.css');
    }
}