当前位置: 首页>>代码示例>>PHP>>正文


PHP panels_get_current_page_display函数代码示例

本文整理汇总了PHP中panels_get_current_page_display函数的典型用法代码示例。如果您正苦于以下问题:PHP panels_get_current_page_display函数的具体用法?PHP panels_get_current_page_display怎么用?PHP panels_get_current_page_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了panels_get_current_page_display函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: radix_preprocess_html

/**
 * Implements template_preprocess_html().
 */
function radix_preprocess_html(&$variables)
{
    global $base_url;
    // Add Bootstrap JS from CDN if bootstrap library is not installed.
    if (!module_exists('bootstrap_library')) {
        $base = parse_url($base_url);
        $url = $base['scheme'] . '://netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js';
        drupal_add_js($url, 'external');
    }
    // Add support for the Modenizr module.
    // Load modernizr.js only if modernizr module is not present.
    if (!module_exists('modernizr')) {
        drupal_add_js(drupal_get_path('theme', 'radix') . '/assets/javascripts/modernizr.js');
    }
    // Add meta for Bootstrap Responsive.
    // <meta name="viewport" content="width=device-width, initial-scale=1.0">
    $element = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'));
    drupal_add_html_head($element, 'bootstrap_responsive');
    // Add some custom classes for panels pages.
    if (module_exists('page_manager') && count(page_manager_get_current_page())) {
        $variables['is_panel'] = TRUE;
        // Get the current panel display and add some classes to body.
        if ($display = panels_get_current_page_display()) {
            $variables['classes_array'][] = 'panel-layout-' . $display->layout;
            // Add a custom class for each region that has content.
            $regions = array_keys($display->panels);
            foreach ($regions as $region) {
                $variables['classes_array'][] = 'panel-region-' . $region;
            }
        }
    }
}
开发者ID:rhabbachi,项目名称:data_starter,代码行数:35,代码来源:template.php

示例2: jbase_preprocess_html

/**
 * Override or insert variables into the html template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function jbase_preprocess_html(&$vars)
{
    // give <body> tag a unique class depending on PATHs
    $path_alias = strtolower(drupal_clean_css_identifier(drupal_get_path_alias($_GET['q'])));
    if ($path_alias == 'node') {
        $vars['classes_array'][] = '';
    } else {
        $vars['classes_array'][] = 'path-' . $path_alias;
    }
    // Add to the array of body classes
    // layout classes
    $vars['classes_array'][] = 'layout-' . (!empty($vars['page']['sidebar_first']) ? 'first-main' : 'main') . (!empty($vars['page']['sidebar_second']) ? '-second' : '');
    // headers classes
    if (!empty($vars['page']['header_first']) || !empty($vars['page']['header_second']) || !empty($vars['page']['header_third'])) {
        $header_regions = 'header';
        $header_regions .= !empty($vars['page']['header_first']) ? '-first' : '';
        $header_regions .= !empty($vars['page']['header_second']) ? '-second' : '';
        $header_regions .= !empty($vars['page']['header_third']) ? '-third' : '';
        $vars['classes_array'][] = $header_regions;
    }
    // preface classes
    if (!empty($vars['page']['preface_first']) || !empty($vars['page']['preface_second']) || !empty($vars['page']['preface_third'])) {
        $preface_regions = 'preface';
        $preface_regions .= !empty($vars['page']['preface_first']) ? '-first' : '';
        $preface_regions .= !empty($vars['page']['preface_second']) ? '-second' : '';
        $preface_regions .= !empty($vars['page']['preface_third']) ? '-third' : '';
        $vars['classes_array'][] = $preface_regions;
    }
    // postscripts classes
    if (!empty($vars['page']['postscript_first']) || !empty($vars['page']['postscript_second']) || !empty($vars['page']['postscript_third'])) {
        $postscript_regions = 'postscript';
        $postscript_regions .= !empty($vars['page']['postscript_first']) ? '-first' : '';
        $postscript_regions .= !empty($vars['page']['postscript_second']) ? '-second' : '';
        $postscript_regions .= !empty($vars['page']['postscript_third']) ? '-third' : '';
        $vars['classes_array'][] = $postscript_regions;
    }
    // footers classes
    if (!empty($vars['page']['footer_first']) || !empty($vars['page']['footer_second']) || !empty($vars['page']['footer_third'])) {
        $footer_regions = 'footers';
        $footer_regions .= !empty($vars['page']['footer_first']) ? '-first' : '';
        $footer_regions .= !empty($vars['page']['footer_second']) ? '-second' : '';
        $footer_regions .= !empty($vars['page']['footer_third']) ? '-third' : '';
        $vars['classes_array'][] = $footer_regions;
    }
    // Panels classes
    $vars['classes_array'][] = module_exists('panels') && panels_get_current_page_display() ? 'panels' : '';
    if (module_exists('panels') && panels_get_current_page_display()) {
        $panels_display = panels_get_current_page_display();
        $vars['classes_array'][] = 'panels-' . strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $panels_display->layout));
    }
    $vars['classes_array'] = array_filter($vars['classes_array']);
    // IE stylesheets
    drupal_add_css(path_to_theme() . '/css/ie7-fixes.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
    drupal_add_css(path_to_theme() . '/css/ie8-fixes.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
}
开发者ID:jaywolf,项目名称:jBase,代码行数:61,代码来源:template.php

示例3: da_vinci_preprocess_html

/**
 * Implements da_vinci_preprocess_html().
 */
function da_vinci_preprocess_html(&$vars)
{
    if (isset($vars['node'])) {
        // For full nodes.
        $vars['classes_array'][] = $vars['node'] ? 'full-node' : '';
        // For forums.
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        $vars['classes_array'][] = panels_get_current_page_display() ? 'panels' : '';
    }
    if (module_exists('libraries')) {
        $lib_dv_dir = libraries_get_path('da-vinci-plugins');
        $lib_easymodal_dir = libraries_get_path('easymodal');
        drupal_add_js($lib_dv_dir . '/css_browser.js');
        if (theme_get_setting('styleguide') && module_exists('styleguide') && module_exists('jquery_update')) {
            $theme_path = drupal_get_path('theme', 'da_vinci');
            $lib_dv_dir = libraries_get_path('da-vinci-plugins');
            drupal_add_js($lib_dv_dir . '/jquery.actual.min.js');
            drupal_add_js($lib_easymodal_dir . '/jquery.easyModal.js');
            drupal_add_js($theme_path . '/js/modales.js');
        }
    }
    if (theme_get_setting('debug')) {
        $vars['html_classes'][] = 'debug';
    }
    // Since menu is rendered in preprocess_page we need to detect it
    // here to add body classes.
    $has_main_menu = theme_get_setting('toggle_main_menu');
    $has_secondary_menu = theme_get_setting('toggle_secondary_menu');
    // Add extra classes to body for more flexible theming.
    if ($has_main_menu or $has_secondary_menu) {
        $vars['classes_array'][] = 'with-navigation';
    }
    if ($has_secondary_menu) {
        $vars['classes_array'][] = 'with-subnav';
    }
    if (!empty($vars['page']['featured'])) {
        $vars['classes_array'][] = 'featured';
    }
    if ($vars['is_admin']) {
        $vars['classes_array'][] = 'admin';
    }
    if (!empty($vars['page']['header_top'])) {
        $vars['classes_array'][] = 'header_top';
    }
    // Add unique classes for each page and website section.
    $path = drupal_get_path_alias($_GET['q']);
    $temp = explode('/', $path, 2);
    $section = array_shift($temp);
    $page_name = array_shift($temp);
    // Add template suggestions.
    $vars['theme_hook_suggestions'][] = "page__section__" . $section;
    $vars['theme_hook_suggestions'][] = "page__" . $page_name;
}
开发者ID:nikasha,项目名称:refugiolahiguera,代码行数:57,代码来源:template.preprocess.html.php

示例4: pechi_preprocess_page

/**
 * Preprocessor for page.tpl.php template file.
 */
function pechi_preprocess_page(&$vars, $hook)
{
    global $language, $user;
    // For easy printing of variables.
    $vars['logo_img'] = $vars['logo'] ? theme('image', substr($vars['logo'], strlen(base_path())), t('Home'), t('Home')) : '';
    $vars['linked_logo_img'] = $vars['logo_img'] ? l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home'), 'html' => TRUE)) : '';
    $vars['linked_site_name'] = $vars['site_name'] ? l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home'), 'title' => t('Home'))) : '';
    $vars['main_menu_links'] = theme('links', $vars['primary_links'], array('class' => 'links main-menu'));
    $vars['secondary_menu_links'] = theme('links', $vars['secondary_links'], array('class' => 'links secondary-menu'));
    // Make sure framework styles are placed above all others.
    $vars['css_alt'] = pechi_css_reorder($vars['css']);
    $vars['styles'] = drupal_get_css($vars['css_alt']);
    drupal_add_js(drupal_get_path('theme', 'pechi') . '/js/pechi.js');
    // Remove sidebars if disabled e.g., for Panels
    if (!$vars['show_blocks']) {
        $vars['sidebar_first'] = '';
        $vars['sidebar_last'] = '';
    }
    // Add to array of helpful body classes
    $body_classes = explode(' ', $vars['body_classes']);
    // Default classes
    $body_classes[] = $language->prefix;
    if (isset($vars['node'])) {
        $body_classes[] = $vars['node'] ? 'full-node' : '';
        // Full node
        $body_classes[] = $vars['node']->type == 'forum' || arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    } else {
        $body_classes[] = arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        // Panels page
        $body_classes[] = panels_get_current_page_display() ? 'panels' : '';
    }
    $body_classes = array_filter($body_classes);
    // Remove empty elements
    $vars['body_classes'] = implode(' ', $body_classes);
    // Create class list separated by spaces
    $vars['body_id'] = 'pid-' . strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', drupal_get_path_alias($_GET['q'])));
    // Add a unique page id
    if (module_exists('uc_product') && uc_product_is_product((int) $vars['node']->nid)) {
        // Kill the page title to surface our own.
        $vars['title'] = NULL;
    }
}
开发者ID:rmontero,项目名称:dla_ecommerce_site,代码行数:49,代码来源:template.php

示例5: radix_preprocess_html

/**
 * Implementation of template_preprocess_html().
 */
function radix_preprocess_html(&$variables)
{
    // Add meta for Bootstrap Responsive.
    // <meta name="viewport" content="width=device-width, initial-scale=1.0">
    $element = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0'));
    drupal_add_html_head($element, 'bootstrap_responsive');
    // Add some custom classes for panels pages.
    if (module_exists('page_manager') && count(page_manager_get_current_page())) {
        $variables['is_panel'] = TRUE;
        // Get the current panel display and add some classes to body.
        if ($display = panels_get_current_page_display()) {
            $variables['classes_array'][] = 'panel-layout-' . $display->layout;
            // Add a custom class for each region that has content.
            $regions = array_keys($display->panels);
            foreach ($regions as $region) {
                $variables['classes_array'][] = 'panel-region-' . $region;
            }
        }
    }
}
开发者ID:radimklaska,项目名称:openatrium-drops-7,代码行数:23,代码来源:template.php

示例6: hpszen_preprocess_html

/**
 * Override or insert variables into the html templates.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("html" in this case.)
 */
function hpszen_preprocess_html(&$variables, $hook)
{
    // Add classes for page names and panels layouts.
    // @note Zen theme uses page_callback on menu_item for determining if this is
    //       a panels page, but that assumes the page has a matching variant that
    //       invokes panels, which is not always the case.
    if ($panels_display = panels_get_current_page_display()) {
        $variables['classes_array'][] = drupal_clean_css_identifier($panels_display->layout);
    } else {
        $variables['classes_array'][] = 'no-panels';
    }
    if ($current_page = page_manager_get_current_page()) {
        $variables['classes_array'][] = drupal_clean_css_identifier($current_page['name']);
    }
    // Strip html from head title
    if ($variables['head_title']) {
        $variables['head_title'] = strip_tags(htmlspecialchars_decode($variables['head_title']));
    }
    // Pass behaviour settings to javascript
    drupal_add_js(array('hpszen' => array('toggleSubNavigation' => theme_get_setting('hpszen_navigation_dropdown'), 'toggleRelatedItemDetail' => theme_get_setting('hpszen_exhibits_js'))), 'setting');
    if (theme_get_setting('hpszen_position_sticky') && module_exists('libraries')) {
        foreach (array('fixedfixed', 'fixedsticky') as $library) {
            if ($library_path = libraries_get_path($library)) {
                $file_path = "{$library_path}/{$library}";
                if (file_exists("{$file_path}.js")) {
                    drupal_add_js("{$file_path}.js");
                    if (file_exists("{$file_path}.css")) {
                        drupal_add_css("{$file_path}.css");
                    }
                }
            }
        }
    }
    // The body tag's classes are controlled by the $classes_array variable. To
    // remove a class from $classes_array, use array_diff().
    //$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove'));
}
开发者ID:bubok,项目名称:hps-drupal-distribution,代码行数:45,代码来源:template.php

示例7: webpro_core_preprocess_html

/**
 * HTML preprocessing
 */
function webpro_core_preprocess_html(&$vars)
{
    global $theme_key, $user;
    // Add to array of helpful body classes.
    if (isset($vars['node'])) {
        // For full nodes.
        $vars['classes_array'][] = $vars['node'] ? 'full-node' : '';
        // For forums.
        $vars['classes_array'][] = $vars['node']->type == 'forum' || arg(0) == 'forum' ? 'forum' : '';
    } else {
        // Forums.
        $vars['classes_array'][] = arg(0) == 'forum' ? 'forum' : '';
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        $vars['classes_array'][] = panels_get_current_page_display() ? 'panels' : '';
    }
    $vars['classes_array'][] = theme_get_setting('theme_font') != 'none' ? theme_get_setting('theme_font') : '';
    $vars['classes_array'][] = theme_get_setting('theme_font_size');
    $vars['classes_array'][] = user_access('administer blocks', $user) && theme_get_setting('grid_mask') ? 'grid-mask-enabled' : '';
    // Add grid classes
    $grid = webpro_core_grid_info();
    // Fixed or fluid.
    $vars['classes_array'][] = 'grid-type-' . $grid['type'];
    // Number of units in the grid (12, 16, etc.)
    $vars['classes_array'][] = 'grid-width-' . sprintf("%02d", $grid['width']);
    // Fluid grid width in %.
    $vars['classes_array'][] = $grid['type'] == 'fluid' ? theme_get_setting('fluid_grid_width') : '';
    // Remove any empty elements in the array.
    $vars['classes_array'] = array_filter($vars['classes_array']);
    // Serialize RDF namespaces into an RDFa 1.1 prefix attribute.
    if (function_exists('rdf_get_namespaces')) {
        foreach (rdf_get_namespaces() as $prefix => $uri) {
            $prefixes[] = $prefix . ': ' . $uri;
        }
        $vars['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
    }
    $themes = webpro_core_theme_paths($theme_key);
    $file = theme_get_setting('theme_grid') . '.css';
    $cache = cache_get('webpro');
    $new_cache = array();
    $vars['mobile_friendly'] = FALSE;
    $vars['classes_array'][] = theme_get_setting('sidebar_layout');
    foreach ($themes as $name => $path) {
        if (empty($cache->data['grid_css'][$name][$file])) {
            if (file_exists($path . '/css/' . $file)) {
                drupal_add_css($path . '/css/' . $file, array('group' => CSS_THEME, 'preprocess' => TRUE));
                $new_cache['grid_css'][$name][$file] = TRUE;
            } else {
                $new_cache['grid_css'][$name][$file] = WEBPRO_FILE_NOT_FOUND;
            }
        } else {
            if ($cache->data['grid_css'][$name][$file] === TRUE) {
                drupal_add_css($path . '/css/' . $file, array('group' => CSS_THEME, 'preprocess' => TRUE));
            }
        }
    }
    // Include any instances of local.css.
    foreach ($themes as $name => $path) {
        // Include any instances of local.css.
        if (empty($cache->data['local_css'][$path])) {
            if (file_exists($path . '/css/local.css')) {
                drupal_add_css($path . '/css/local.css', array('group' => CSS_THEME, 'preprocess' => TRUE));
                $new_cache['local_css'][$path] = TRUE;
            } else {
                $new_cache['local_css'][$path] = WEBPRO_FILE_NOT_FOUND;
            }
        } else {
            if ($cache->data['local_css'][$path] === TRUE) {
                drupal_add_css($path . '/css/local.css', array('group' => CSS_THEME, 'preprocess' => TRUE));
            }
        }
    }
    // Add a unique page id.
    $vars['body_id'] = 'pid-' . drupal_clean_css_identifier(drupal_get_path_alias($_GET['q']));
    // Update cache, if necessary.
    if ($new_cache) {
        cache_set('webpro', $new_cache, 'cache', CACHE_TEMPORARY);
    }
}
开发者ID:DespinosaFA,项目名称:drupal-web,代码行数:82,代码来源:template.php

示例8: fusion_core_preprocess_page

/**
 * Page preprocessing
 */
function fusion_core_preprocess_page(&$vars)
{
    global $language, $theme_key, $theme_info, $user;
    // Remove sidebars if disabled e.g., for Panels
    if (!$vars['show_blocks']) {
        $vars['sidebar_first'] = '';
        $vars['sidebar_last'] = '';
    }
    // Set grid info & row widths
    $grid_name = substr(theme_get_setting('theme_grid'), 0, 7);
    $grid_type = substr(theme_get_setting('theme_grid'), 7);
    $grid_width = (int) substr($grid_name, 4, 2);
    $vars['grid_width'] = $grid_name . $grid_width;
    $sidebar_first_width = $vars['sidebar_first'] ? theme_get_setting('sidebar_first_width') : 0;
    $sidebar_last_width = $vars['sidebar_last'] ? theme_get_setting('sidebar_last_width') : 0;
    $vars['sidebar_first_width'] = $grid_name . $sidebar_first_width;
    $vars['main_group_width'] = $grid_name . ($grid_width - $sidebar_first_width);
    // For nested elements in a fluid grid calculate % widths & add inline
    if ($grid_type == 'fluid') {
        $sidebar_last_width = round($sidebar_last_width / ($grid_width - $sidebar_first_width) * 100, 2);
        $vars['content_group_width'] = '" style="width:' . (100 - $sidebar_last_width) . '%';
        $vars['sidebar_last_width'] = '" style="width:' . $sidebar_last_width . '%';
    } else {
        $vars['content_group_width'] = $grid_name . ($grid_width - ($sidebar_first_width + $sidebar_last_width));
        $vars['sidebar_last_width'] = $grid_name . $sidebar_last_width;
    }
    // Build array of helpful body classes
    $body_classes = explode(' ', $vars['body_classes']);
    // Default classes
    $body_classes[] = arg(0) == 'admin' ? 'admin-page' : '';
    // Admin page
    if (isset($vars['node'])) {
        $body_classes[] = $vars['node'] ? 'full-node' : '';
        // Full node
        $body_classes[] = $vars['node']->type == 'forum' || arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    } else {
        $body_classes[] = arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        // Panels page
        $body_classes[] = panels_get_current_page_display() ? 'panels' : '';
    }
    $body_classes[] = 'layout-' . ($vars['sidebar_first'] ? 'first-main' : 'main') . ($vars['sidebar_last'] ? '-last' : '');
    // Sidebars active
    $body_classes[] = theme_get_setting('sidebar_layout');
    // Sidebar layout
    $body_classes[] = theme_get_setting('theme_font') != 'none' ? theme_get_setting('theme_font') : '';
    // Font family
    $body_classes[] = theme_get_setting('theme_font_size');
    // Font size
    $body_classes[] = user_access('administer blocks', $user) && theme_get_setting('grid_mask') ? 'grid-mask-enabled' : '';
    // Grid mask overlay
    $body_classes[] = 'grid-type-' . $grid_type;
    // Fixed width or fluid
    $body_classes[] = 'grid-width-' . $grid_width;
    // Grid width in units
    $body_classes[] = $grid_type == 'fluid' ? theme_get_setting('fluid_grid_width') : '';
    // Fluid grid width in %
    $body_classes = array_filter($body_classes);
    // Remove empty elements
    $vars['body_classes'] = implode(' ', $body_classes);
    // Create class list separated by spaces
    $vars['body_id'] = 'pid-' . strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', drupal_get_path_alias($_GET['q'])));
    // Add a unique page id
    // Generate menu tree from primary links, add Superfish class
    $vars['primary_links_tree'] = '';
    if ($vars['primary_links']) {
        $primary_tree = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
        $vars['primary_links_tree'] = preg_replace('/^<ul class="menu/i', '<ul class="menu sf-menu', $primary_tree, 1);
    }
    // Remove breadcrumbs if disabled
    if (theme_get_setting('breadcrumb_display') == 0) {
        $vars['breadcrumb'] = '';
    }
    // Add grid, color, ie6, ie7, ie8 & local stylesheets, including inherited & rtl versions
    $grid_style = '/css/' . theme_get_setting('theme_grid');
    $color_style = '/css/' . theme_get_setting('theme_color');
    $themes = fusion_core_theme_paths($theme_key);
    $vars['setting_styles'] = $vars['ie6_styles'] = $vars['ie7_styles'] = $vars['ie8_styles'] = $vars['local_styles'] = '';
    foreach ($themes as $name => $path) {
        $link = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . $path;
        $vars['setting_styles'] .= file_exists($path . $grid_style . '.css') ? $link . $grid_style . '.css" />' . "\n" : '';
        $vars['setting_styles'] .= file_exists($path . $color_style . '.css') ? $link . $color_style . '.css" />' . "\n" : '';
        $vars['ie6_styles'] .= file_exists($path . '/css/ie6-fixes.css') ? $link . '/css/ie6-fixes.css" />' . "\n" : '';
        $vars['ie7_styles'] .= file_exists($path . '/css/ie7-fixes.css') ? $link . '/css/ie7-fixes.css" />' . "\n" : '';
        $vars['ie8_styles'] .= file_exists($path . '/css/ie8-fixes.css') ? $link . '/css/ie8-fixes.css" />' . "\n" : '';
        $vars['local_styles'] .= file_exists($path . '/css/local.css') ? $link . '/css/local.css" />' . "\n" : '';
        if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
            $vars['setting_styles'] .= file_exists($path . $grid_style . '-rtl.css') ? $link . $grid_style . '-rtl.css" />' . "\n" : '';
            $vars['setting_styles'] .= file_exists($path . $color_style . '-rtl.css') ? $link . $color_style . '-rtl.css" />' . "\n" : '';
            $vars['ie6_styles'] .= file_exists($path . '/css/ie6-fixes-rtl.css') ? $link . '/css/ie6-fixes-rtl.css" />' . "\n" : '';
            $vars['ie7_styles'] .= file_exists($path . '/css/ie7-fixes-rtl.css') ? $link . '/css/ie7-fixes-rtl.css" />' . "\n" : '';
            $vars['ie8_styles'] .= file_exists($path . '/css/ie8-fixes-rtl.css') ? $link . '/css/ie8-fixes-rtl.css" />' . "\n" : '';
            $vars['local_styles'] .= file_exists($path . '/css/local-rtl.css') ? $link . '/css/local-rtl.css" />' . "\n" : '';
        }
//.........这里部分代码省略.........
开发者ID:quinns,项目名称:ghmls,代码行数:101,代码来源:template.php

示例9: render_entity

 /**
  * Render the panels display for a given panelizer entity.
  *
  * @param stdClass $entity
  *   A fully-loaded entity object controlled by panelizer.
  * @param array $args
  *   Optional array of arguments to pass to the panels display.
  * @param string $address
  *   An optional address to send to the renderer to use for addressable
  *   content.
  *
  * @return array
  *   If the entity isn't panelized, this returns NULL. Otherwise, it returns an
  *   associative array as meant for use with CTools with the following keys:
  *   - 'content': String containing the rendered panels display output.
  *   - 'no_blocks': Boolean defining if the panels display wants to hide core
  *      blocks or not when being rendered.
  */
 function render_entity($entity, $view_mode, $langcode = NULL, $args = array(), $address = NULL)
 {
     if (empty($entity->panelizer[$view_mode]) || empty($entity->panelizer[$view_mode]->display)) {
         return FALSE;
     }
     list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
     $panelizer = $entity->panelizer[$view_mode];
     $display = $panelizer->display;
     $display->context = $this->get_contexts($panelizer, $entity);
     $display->args = $args;
     $display->css_id = $panelizer->css_id;
     // This means the IPE will use our cache which means it will get appropriate
     // allowed content should it be selected.
     $display->cache_key = implode(':', array('panelizer', $this->entity_type, $entity_id, $view_mode));
     // Check to see if there is any CSS.
     if (!empty($panelizer->css)) {
         ctools_include('css');
         $filename = ctools_css_retrieve($display->cache_key);
         if (!$filename) {
             $filename = ctools_css_store($display->cache_key, $panelizer->css);
         }
         drupal_add_css($filename, array('group' => CSS_THEME));
     }
     if ($view_mode == 'page_manager') {
         // We think this is handled as a page, so set the current page display.
         panels_get_current_page_display($display);
     }
     ctools_include('plugins', 'panels');
     $renderer = panels_get_renderer($panelizer->pipeline, $display);
     $renderer->address = $address;
     $info = array('content' => panels_render_display($display, $renderer), 'no_blocks' => !empty($panelizer->no_blocks));
     $info['classes_array'] = array();
     if (!empty($panelizer->css_class)) {
         ctools_include('cleanstring');
         foreach (explode(' ', $panelizer->css_class) as $class) {
             $class = ctools_context_keyword_substitute($class, array(), $display->context);
             if ($class) {
                 $info['classes_array'][] = ctools_cleanstring($class);
             }
         }
     }
     $info['title'] = $display->get_title();
     return $info;
 }
开发者ID:rexxllabore,项目名称:acme,代码行数:62,代码来源:PanelizerEntityDefault.class.php

示例10: fusion_core_preprocess_page

/**
 * Page preprocessing
 */
function fusion_core_preprocess_page(&$vars)
{
    global $language, $theme_key, $theme_info;
    static $sidebar_first_width, $sidebar_last_width;
    // Remove sidebars if disabled e.g., for Panels
    if (!$vars['show_blocks']) {
        $vars['sidebar_first'] = '';
        $vars['sidebar_last'] = '';
    }
    // Set grid info & row widths
    $grid_name = substr(theme_get_setting('theme_grid'), 0, 7);
    $grid_type = substr(theme_get_setting('theme_grid'), 7);
    $grid_width = (int) substr($grid_name, 4, 2);
    if (!isset($sidebar_first_width)) {
        $sidebar_first_width = $sidebar_last_width = 0;
        if ($vars['sidebar_first']) {
            $sidebar_first_width = isset($theme_info->info['settings']['sidebar-first-width']) ? $theme_info->info['settings']['sidebar-first-width'] : 3;
            $sidebar_first_width = theme_get_setting('sidebar_first_width') > 0 ? theme_get_setting('sidebar_first_width') : $sidebar_first_width;
        }
        if ($vars['sidebar_last']) {
            $sidebar_last_width = isset($theme_info->info['settings']['sidebar-last-width']) ? $theme_info->info['settings']['sidebar-last-width'] : 3;
            $sidebar_last_width = theme_get_setting('sidebar_last_width') > 0 ? theme_get_setting('sidebar_last_width') : $sidebar_last_width;
        }
    }
    $vars['grid_width'] = $grid_name . $grid_width;
    $vars['sidebar_first_width'] = $grid_name . $sidebar_first_width;
    $vars['main_group_width'] = $grid_name . ($grid_width - $sidebar_first_width);
    // For nested elements in a fluid grid calculate % widths & add inline
    if ($grid_type == 'fluid') {
        $sidebar_last_width = round($sidebar_last_width / ($grid_width - $sidebar_first_width) * 100, 2);
        $vars['content_group_width'] = '" style="width:' . (100 - $sidebar_last_width) . '%"';
        $vars['sidebar_last_width'] = '" style="width:' . $sidebar_last_width . '%"';
    } else {
        $vars['content_group_width'] = $grid_name . ($grid_width - ($sidebar_first_width + $sidebar_last_width));
        $vars['sidebar_last_width'] = $grid_name . $sidebar_last_width;
    }
    // Build array of helpful body classes
    $body_classes = array();
    $body_classes[] = $vars['logged_in'] ? 'logged-in' : 'not-logged-in';
    // User logged in
    $body_classes[] = $vars['is_front'] ? 'front' : 'not-front';
    // Front page
    $body_classes[] = arg(0) == 'admin' ? 'admin-page' : '';
    // Admin page
    if (isset($vars['node'])) {
        $body_classes[] = $vars['node'] ? 'full-node' : '';
        // Full node
        $body_classes[] = $vars['node']->type == 'forum' || arg(0) == 'forum' ? 'forum' : '';
        // Forum page
        $body_classes[] = $vars['node']->type ? 'node-type-' . $vars['node']->type : '';
        // Node type
    } else {
        $body_classes[] = arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        // Panels page
        $body_classes[] = panels_get_current_page_display() ? 'panels' : '';
    }
    $body_classes[] = 'layout-' . ($vars['sidebar_first'] ? 'first-main' : 'main') . ($vars['sidebar_last'] ? '-last' : '');
    // Sidebars active
    $body_classes[] = theme_get_setting('theme_font') != 'none' ? theme_get_setting('theme_font') : '';
    // Font family
    $body_classes[] = theme_get_setting('theme_font_size') != 'none' ? theme_get_setting('theme_font_size') : '';
    // Font size
    $body_classes[] = 'grid-type-' . $grid_type;
    // Fixed width or fluid
    $body_classes = array_filter($body_classes);
    // Remove empty elements
    $vars['body_classes'] = implode(' ', $body_classes);
    // Create class list separated by spaces
    // Check for sub-theme custom header
    $header_file = drupal_get_path('theme', $theme_key) . '/custom-header.php';
    $vars['custom_header'] = file_exists($header_file) ? $header_file : '';
    // Generate menu tree from primary links, add Superfish class
    $primary_tree = menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
    $vars['primary_links_tree'] = preg_replace('/^<ul class="menu/i', '<ul class="menu sf-menu', $primary_tree, 1);
    // Add grid, color, ie6, ie7 & local stylesheets, including inherited & rtl versions
    $grid_style = '/css/' . theme_get_setting('theme_grid');
    $color_style = '/css/' . theme_get_setting('theme_color');
    $themes = fusion_core_theme_paths($theme_key);
    $vars['setting_styles'] = $vars['ie6_styles'] = $vars['ie7_styles'] = $vars['local_styles'] = '';
    foreach ($themes as $name => $path) {
        $link = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . $path;
        $vars['setting_styles'] .= file_exists($path . $grid_style . '.css') ? $link . $grid_style . '.css" />' . "\n" : '';
        $vars['setting_styles'] .= file_exists($path . $color_style . '.css') ? $link . $color_style . '.css" />' . "\n" : '';
        $vars['ie6_styles'] .= file_exists($path . '/css/ie6-fixes.css') ? $link . '/css/ie6-fixes.css" />' . "\n" : '';
        $vars['ie7_styles'] .= file_exists($path . '/css/ie7-fixes.css') ? $link . '/css/ie7-fixes.css" />' . "\n" : '';
        $vars['local_styles'] .= file_exists($path . '/css/local.css') ? $link . '/css/local.css" />' . "\n" : '';
        if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
            $vars['setting_styles'] .= file_exists($path . $grid_style . '-rtl.css') ? $link . $grid_style . '-rtl.css" />' . "\n" : '';
            $vars['setting_styles'] .= file_exists($path . $color_style . '-rtl.css') ? $link . $color_style . '-rtl.css" />' . "\n" : '';
            $vars['ie6_styles'] .= file_exists($path . '/css/ie6-fixes-rtl.css') ? $link . '/css/ie6-fixes-rtl.css" />' . "\n" : '';
            $vars['ie7_styles'] .= file_exists($path . '/css/ie7-fixes-rtl.css') ? $link . '/css/ie7-fixes-rtl.css" />' . "\n" : '';
            $vars['local_styles'] .= file_exists($path . '/css/local-rtl.css') ? $link . '/css/local-rtl.css" />' . "\n" : '';
        }
    }
//.........这里部分代码省略.........
开发者ID:aakb,项目名称:alice,代码行数:101,代码来源:template.php

示例11: loop_preprocess_page

/**
 * Override or insert variables into the page template.
 */
function loop_preprocess_page(&$variables)
{
    global $user;
    $arg = arg();
    if ($user->uid > 0) {
        // Prepare system search block for page.tpl.
        if (module_exists('search_api_page')) {
            $variables['search'] = module_invoke('search_api_page', 'block_view', 'default');
        } else {
            $variables['search'] = module_invoke('search', 'block_view', 'form');
        }
    }
    // Drupal core got a minor bug with active trail on 'My account'.
    if ($arg[0] == 'user' && isset($arg[1]) && is_numeric($arg[1])) {
        if (!isset($arg[2])) {
            menu_set_active_item('user');
        } else {
            if ($arg[2] != 'messages') {
                menu_set_active_item('user');
            }
        }
    }
    if ($variables['is_front']) {
        $update_script_path = $GLOBALS['base_root'] . '/' . path_to_theme() . '/scripts/frontpage-column-width.js';
        drupal_add_js($update_script_path, 'file');
    }
    // Remove search form when no search results are found.
    if (isset($variables['page']['content']['system_main']['results']) && $variables['page']['content']['system_main']['results']['#results']['result count'] == 0) {
        unset($variables['page']['content']['system_main']['form']);
    }
    // Fetch a user block (my content) on user pages).
    if ($arg[0] == 'user') {
        $variables['loop_user_my_content'] = module_invoke('loop_user', 'block_view', 'loop_user_my_content');
        if (module_exists('pcp')) {
            $variables['user_completion_block'] = module_invoke('pcp', 'block_view', 'pcp_profile_percent_complete');
        }
        hide($variables['tabs']['#secondary']);
    }
    if ($arg[0] == 'front') {
        $variables['loop_frontpage_welcometext'] = module_invoke('loop_frontpage', 'block_view', 'loop_frontpage_welcometext');
    }
    // Load Loop primary menu.
    if (module_exists('loop_navigation') && $user->uid > 0) {
        $variables['main_menu_block'] = module_invoke('system', 'block_view', 'main-menu');
        $variables['management_menu_block'] = module_invoke('system', 'block_view', 'management');
        $variables['primary_menu_block'] = module_invoke('menu', 'block_view', 'menu-loop-primary-menu');
    }
    // Load Loop user menu.
    if (module_exists('loop_user') && $arg[0] == 'user') {
        $variables['user_menu_block'] = module_invoke('system', 'block_view', 'user-menu');
        $variables['user_public_block'] = module_invoke('loop_user', 'block_view', 'loop_user_my_content');
    }
    // Check if we are using a panel page to define layout.
    $panel = panels_get_current_page_display();
    if (empty($panel)) {
        $variables['no_panel'] = TRUE;
        if ($arg['0'] == 'search') {
            $variables['layout_class'] = 'layout-full-width';
        } else {
            $variables['layout_class'] = 'layout-default-inverted';
        }
    }
    // We add logout link here to be able to always print it last. (Hence not part
    // of any menu).
    if ($user->uid > 0 && !(array_key_exists('hide_logout', $variables) && $variables['hide_logout'])) {
        $variables['logout_link'] = l(t('Logout'), 'user/logout', array('attributes' => array('class' => array('nav--logout'))));
    }
    // Set title for page types. For some reason it does not work through page
    // title module.
    if (!empty($variables['node'])) {
        if ($variables['node']->type == 'page') {
            // Set page title.
            drupal_set_title($variables['node']->title);
        }
    }
}
开发者ID:faxe-kommune,项目名称:OS2loop,代码行数:79,代码来源:template.php

示例12: fusion_core_preprocess_html

/**
 * HTML preprocessing
 */
function fusion_core_preprocess_html(&$vars)
{
    global $theme_key, $user;
    // Add to array of helpful body classes.
    if (isset($vars['node'])) {
        // For full nodes.
        $vars['classes_array'][] = $vars['node'] ? 'full-node' : '';
        // For forums.
        $vars['classes_array'][] = $vars['node']->type == 'forum' || arg(0) == 'forum' ? 'forum' : '';
    } else {
        // Forums.
        $vars['classes_array'][] = arg(0) == 'forum' ? 'forum' : '';
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        $vars['classes_array'][] = panels_get_current_page_display() ? 'panels' : '';
    }
    $vars['classes_array'][] = theme_get_setting('theme_font') != 'none' ? theme_get_setting('theme_font') : '';
    $vars['classes_array'][] = theme_get_setting('theme_font_size');
    $vars['classes_array'][] = user_access('administer blocks', $user) && theme_get_setting('grid_mask') ? 'grid-mask-enabled' : '';
    // Add grid classes
    $grid = fusion_core_grid_info();
    // Fixed or fluid.
    $vars['classes_array'][] = 'grid-type-' . $grid['type'];
    // Number of units in the grid (12, 16, etc.)
    $vars['classes_array'][] = 'grid-width-' . sprintf("%02d", $grid['width']);
    // Fluid grid width in %.
    $vars['classes_array'][] = $grid['type'] == 'fluid' ? theme_get_setting('fluid_grid_width') : '';
    // Remove any empty elements in the array.
    $vars['classes_array'] = array_filter($vars['classes_array']);
    // Serialize RDF namespaces into an RDFa 1.1 prefix attribute.
    if (function_exists('rdf_get_namespaces')) {
        foreach (rdf_get_namespaces() as $prefix => $uri) {
            $prefixes[] = $prefix . ': ' . $uri;
        }
        $vars['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
    }
    $themes = fusion_core_theme_paths($theme_key);
    $file = theme_get_setting('theme_grid') . '.css';
    $cache = cache_get('fusion');
    $new_cache = array();
    if (module_exists('fusion_accelerator') && theme_get_setting('responsive_enabled')) {
        $responsive_path = variable_get($theme_key . '_responsive_path');
        $responsive_file = variable_get($theme_key . '_responsive_css');
        if (empty($cache->data['grid_generated'])) {
            $rebuild_css = FALSE;
            if (!$responsive_path || $responsive_file) {
                // Variables are missing, either because the settings have never been accessed
                // or they've been manually deleted.
                $rebuild_css = TRUE;
            } elseif (!file_exists($responsive_path . '/' . $responsive_css)) {
                $rebuild_css = TRUE;
            }
            if ($rebuild_css) {
                // rebuild responsive CSS based on theme defaults.
                $responsive_options = _fusion_accelerator_get_responsive_options($theme_key);
                $options = array();
                foreach ($responsive_options as $op) {
                    if ($setting = theme_get_setting($op, $theme_key)) {
                        $options[$op] = $setting;
                    }
                }
                $options['theme'] = $theme_key;
                $options['units'] = $options['responsive_columns'];
                $options['responsive'] = TRUE;
                _fusion_accelerator_save_grid($options);
                $new_cache['grid_generated'] = TRUE;
            }
        }
        // Add classes to indicate the sidebar widths across all responsive layouts.
        // Consolidate information about various layouts.
        $vars['mobile_friendly'] = TRUE;
        $vars['show_current_grid'] = theme_get_setting('grid_mask') ? TRUE : FALSE;
        // Fetch responsive grid.
        $path = variable_get($theme_key . '_responsive_path');
        $responsive_css = variable_get($theme_key . '_responsive_css');
        if ($path && $responsive_css) {
            // Generated by theme settings.
            drupal_add_css($path . '/' . $responsive_css);
        }
    } else {
        // Fusion Accelerator does not exist, or responsive has been disabled.
        // Search themes for grid files, and use those.
        $vars['mobile_friendly'] = FALSE;
        $vars['classes_array'][] = theme_get_setting('sidebar_layout');
        foreach ($themes as $name => $path) {
            if (empty($cache->data['grid_css'][$name][$file])) {
                if (file_exists($path . '/css/' . $file)) {
                    drupal_add_css($path . '/css/' . $file, array('group' => CSS_THEME, 'preprocess' => TRUE));
                    $new_cache['grid_css'][$name][$file] = TRUE;
                } else {
                    $new_cache['grid_css'][$name][$file] = FUSION_FILE_NOT_FOUND;
                }
            } else {
                if ($cache->data['grid_css'][$name][$file] === TRUE) {
                    drupal_add_css($path . '/css/' . $file, array('group' => CSS_THEME, 'preprocess' => TRUE));
                }
            }
//.........这里部分代码省略.........
开发者ID:vorvor,项目名称:diszkont,代码行数:101,代码来源:template.php

示例13: zeropoint_preprocess_html

/**
 * HTML preprocessing
 */
function zeropoint_preprocess_html(&$vars)
{
    global $theme_key, $user;
    // Add to array of helpful body classes
    $vars['classes_array'][] = $vars['is_admin'] ? 'admin' : 'not-admin';
    // Page user is admin
    if (isset($vars['node'])) {
        $vars['classes_array'][] = $vars['node'] ? 'full-node' : '';
        // Full node
        $vars['classes_array'][] = $vars['node']->type == 'forum' || arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    } else {
        $vars['classes_array'][] = arg(0) == 'forum' ? 'forum' : '';
        // Forum page
    }
    if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
        // Panels page
        $vars['classes_array'][] = panels_get_current_page_display() ? 'panels' : '';
    }
    // Add unique classes for each page and website section
    if (!$vars['is_front']) {
        $path = drupal_get_path_alias($_GET['q']);
        list($section, ) = explode('/', $path, 2);
        $vars['classes_array'][] = 'section-' . $section;
        $vars['classes_array'][] = 'page-' . $path;
    }
    // Build array of additional body classes and retrieve custom theme settings
    $layoutwidth = theme_get_setting('layout-width');
    if ($layoutwidth == '0') {
        $vars['classes_array'][] = 'layout-jello';
    }
    if ($layoutwidth == '1') {
        $vars['classes_array'][] = 'layout-fluid';
    }
    if ($layoutwidth == '2') {
        $vars['classes_array'][] = 'layout-fixed';
    }
    $sidebarslayout = theme_get_setting('sidebarslayout');
    if ($sidebarslayout == '0') {
        $vars['classes_array'][] = 'var';
    }
    if ($sidebarslayout == '1') {
        $vars['classes_array'][] = 'fix';
    }
    if ($sidebarslayout == '2') {
        $vars['classes_array'][] = 'var1';
    }
    if ($sidebarslayout == '3') {
        $vars['classes_array'][] = 'fix1';
    }
    if ($sidebarslayout == '4') {
        $vars['classes_array'][] = 'eq';
    }
    $blockicons = theme_get_setting('blockicons');
    if ($blockicons == '1') {
        $vars['classes_array'][] = 'bicons32';
    }
    if ($blockicons == '2') {
        $vars['classes_array'][] = 'bicons48';
    }
    $pageicons = theme_get_setting('pageicons');
    if ($pageicons == '1') {
        $vars['classes_array'][] = 'picons';
    }
    $headerimg = theme_get_setting('headerimg');
    if ($headerimg == '1') {
        $vars['classes_array'][] = 'himg';
    }
    $vars['classes_array'] = array_filter($vars['classes_array']);
    // Remove empty elements
    // Add language and site ID classes
    $vars['classes_array'][] = $vars['language']->language ? 'lg-' . $vars['language']->language : '';
    // Page has lang-x
    $siteid = theme_get_setting('siteid');
    $vars['classes_array'][] = $siteid;
    // Add a unique page id
    $vars['body_id'] = 'pid-' . strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', drupal_get_path_alias($_GET['q'])));
    // Set IE6 & IE7 stylesheets
    drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 6', '!IE' => FALSE), 'preprocess' => FALSE));
    drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
    drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/style-zero.css', array('group' => CSS_THEME, 'every_page' => TRUE));
    drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/' . get_zeropoint_style() . '.css', array('group' => CSS_THEME, 'every_page' => TRUE));
    drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/_custom/custom-style.css', array('group' => CSS_THEME, 'every_page' => TRUE));
    $roundcorners = theme_get_setting('roundcorners');
    if ($roundcorners == '1') {
        drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/round.css', array('group' => CSS_THEME, 'every_page' => TRUE));
    }
    drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/print.css', array('group' => CSS_THEME, 'media' => 'print', 'every_page' => TRUE));
    $vars['page_b'] = $vars['is_front'] ? '<div class="by"><a href="http://www.radut.net">by Dr. Radut</a></div>' : '<div class="by"><a href="http://www.radut.net">Dr. Radut Consulting</a></div>';
}
开发者ID:tad-kellermann,项目名称:dmark,代码行数:93,代码来源:template.php

示例14: render_entity

 /**
  * Render the panels display for a given panelizer entity.
  *
  * @param stdClass $entity
  *   A fully-loaded entity object controlled by panelizer.
  * @param array $args
  *   Optional array of arguments to pass to the panels display.
  * @param string $address
  *   An optional address to send to the renderer to use for addressable
  *   content.
  * @param array $extra_contexts
  *   An optional array of extra context objects that will be added to the
  *   display.
  *
  * @return array
  *   If the entity isn't panelized, this returns NULL. Otherwise, it returns an
  *   associative array as meant for use with CTools with the following keys:
  *   - 'content': String containing the rendered panels display output.
  *   - 'no_blocks': Boolean defining if the panels display wants to hide core
  *      blocks or not when being rendered.
  */
 function render_entity($entity, $view_mode, $langcode = NULL, $args = array(), $address = NULL, $extra_contexts = array())
 {
     if (empty($entity->panelizer[$view_mode]) || empty($entity->panelizer[$view_mode]->display)) {
         return FALSE;
     }
     list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
     $panelizer = $entity->panelizer[$view_mode];
     $display = $panelizer->display;
     $display->context = $this->get_contexts($panelizer, $entity) + $extra_contexts;
     $display->args = $args;
     $display->css_id = $panelizer->css_id;
     // This means the IPE will use our cache which means it will get appropriate
     // allowed content should it be selected.
     $display->cache_key = implode(':', array_filter(array('panelizer', $this->entity_type, $entity_id, $view_mode, $revision_id)));
     // Check to see if there is any CSS.
     if (!empty($panelizer->css)) {
         ctools_include('css');
         $filename = ctools_css_retrieve($display->cache_key);
         if (!$filename) {
             $filename = ctools_css_store($display->cache_key, $panelizer->css);
         }
         drupal_add_css($filename, array('group' => CSS_THEME));
     }
     if ($view_mode == 'page_manager') {
         // We think this is handled as a page, so set the current page display.
         panels_get_current_page_display($display);
     }
     // Allow applications to alter the panelizer and the display before rendering them.
     drupal_alter('panelizer_pre_render', $panelizer, $display, $entity);
     ctools_include('plugins', 'panels');
     $renderer = panels_get_renderer($panelizer->pipeline, $display);
     // If the IPE is enabled, but the user does not have access to edit
     // the entity, load the standard renderer instead.
     // Use class_parents so we don't try to autoload the class we are testing.
     $parents = class_parents($renderer);
     if (!empty($parents['panels_renderer_editor']) && (!$this->panelizer_access('content', $entity, $view_mode) && !$this->entity_access('update', $entity))) {
         $renderer = panels_get_renderer_handler('standard', $display);
     }
     $renderer->address = $address;
     $info = array('title' => $panelizer->display->get_title(), 'content' => panels_render_display($display, $renderer), 'no_blocks' => !empty($panelizer->no_blocks));
     $info['classes_array'] = array();
     if (!empty($panelizer->css_class)) {
         foreach (explode(' ', $panelizer->css_class) as $class) {
             $class = ctools_context_keyword_substitute($class, array(), $display->context);
             if ($class) {
                 $info['classes_array'][] = drupal_html_class($class);
             }
         }
     }
     if (!empty($parents['panels_renderer_editor'])) {
         $path = drupal_get_path('module', 'panelizer');
         ctools_add_js('panelizer-ipe', 'panelizer');
         drupal_add_js($path . "/js/panelizer-ipe.js", array('group' => JS_LIBRARY));
         drupal_add_css($path . "/css/panelizer-ipe.css");
     }
     return $info;
 }
开发者ID:Probo-Demos,项目名称:drupal_github,代码行数:78,代码来源:PanelizerEntityDefault.class.php

示例15: fusion_core_preprocess_html

/**
 * HTML preprocessing
 */
function fusion_core_preprocess_html(&$vars) {
  global $theme_key, $user;

  // Add to array of helpful body classes.
  if (isset($vars['node'])) {
    // For full nodes.
    $vars['classes_array'][] = ($vars['node']) ? 'full-node' : '';
    // For forums.
    $vars['classes_array'][] = (($vars['node']->type == 'forum') || (arg(0) == 'forum')) ? 'forum' : '';
  }
  else {
    // Forums.
    $vars['classes_array'][] = (arg(0) == 'forum') ? 'forum' : '';
  }
  if (module_exists('panels') && function_exists('panels_get_current_page_display')) {
    $vars['classes_array'][] = (panels_get_current_page_display()) ? 'panels' : '';
  }
  $vars['classes_array'][] = theme_get_setting('sidebar_layout');
  $vars['classes_array'][] = (theme_get_setting('theme_font') != 'none') ? theme_get_setting('theme_font') : '';
  $vars['classes_array'][] = theme_get_setting('theme_font_size');
  $vars['classes_array'][] = (user_access('administer blocks', $user) && theme_get_setting('grid_mask')) ? 'grid-mask-enabled' : '';

  // Add grid classes
  $grid = fusion_core_grid_info();
  
  // Fixed or fluid.
  $vars['classes_array'][] = 'grid-type-' . $grid['type'];
  
  // Number of units in the grid (12, 16, etc.)
  $vars['classes_array'][] = 'grid-width-' . sprintf("%02d", $grid['width']);
  
  // Fluid grid width in %.
  $vars['classes_array'][] = ($grid['type'] == 'fluid') ? theme_get_setting('fluid_grid_width') : '';
  
  // Remove any empty elements in the array.
  $vars['classes_array'] = array_filter($vars['classes_array']);

  // Add a unique page id.
  $vars['body_id'] = 'pid-' . strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', drupal_get_path_alias($_GET['q'])));

  // Add grid, local, & IE stylesheets, including versions inherited from parent themes
  $themes = fusion_core_theme_paths($theme_key);
  foreach ($themes as $name => $path) {
    $file = theme_get_setting('theme_grid') . '.css';
    if (file_exists($path . '/css/' . $file)) {
      drupal_add_css($path . '/css/' . $file, array('basename' => $name . '-' . $file, 'group' => CSS_THEME, 'preprocess' => TRUE));
    }
    if (file_exists($path . '/css/local.css')) {
      drupal_add_css($path . '/css/local.css', array('basename' => $name . '-local.css', 'group' => CSS_THEME, 'preprocess' => TRUE));
    }
    for ($v = 6; $v <= 9; $v++) {
      $file = 'ie' . $v . '-fixes.css';
      if (file_exists($path . '/css/' . $file)) {
        drupal_add_css($path . '/css/' . $file, 
          array(
            'basename' => $name . '-' . $file, 
            'group' => CSS_THEME, 
            'browsers' => array(
              'IE' => 'IE ' . $v, 
              '!IE' => FALSE), 
            'preprocess' => FALSE)
        );
      }
    }
  }
}
开发者ID:richielokay,项目名称:drupal7,代码行数:69,代码来源:template.php


注:本文中的panels_get_current_page_display函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。