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


PHP menu_tree_output函数代码示例

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


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

示例1: fs_core_preprocess_page

/**
 * Implemements hook_process_page
 * @param array $variables
 */
function fs_core_preprocess_page(&$variables)
{
    //Search form
    $search_form = drupal_get_form('search_form');
    $search_form_box = drupal_render($search_form);
    $variables['search_box'] = $search_form_box;
    if ($views_page = views_get_page_view()) {
        $variables['theme_hook_suggestions'][] = 'page__views__' . $views_page->name;
        $variables['theme_hook_suggestions'][] = 'page__views__' . $views_page->name . '_' . $views_page->current_display;
    }
    if (isset($variables['node']->type)) {
        $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
    }
    // changes the links tree for the main menu, since by
    // default Drupal just provides first level ones
    $menu_tree = menu_tree_all_data('main-menu');
    $menu_tree = menu_tree_output($menu_tree);
    foreach ($menu_tree as $k => $v) {
        if (is_numeric($k) && count($v['#below'])) {
            $menu_tree[$k]['#below']['#theme_wrappers'][0] = 'menu_tree__submenu';
        }
    }
    $variables['main_menu'] = $menu_tree;
    if (arg(0) == 'taxonomy' && arg(1) == 'term') {
        $tid = (int) arg(2);
        $term = taxonomy_term_load($tid);
        if (is_object($term)) {
            $variables['theme_hook_suggestions'][] = 'page__taxonomy__' . $term->vocabulary_machine_name;
        }
    }
}
开发者ID:phpsubbarao,项目名称:test-core,代码行数:35,代码来源:template.php

示例2: scsmetronic_subtheme_preprocess_page

/**
 * Processes variables for block.tpl.php.
 *
 * Prepares the values passed to the theme_block function to be passed
 * into a pluggable template engine. Uses block properties to generate a
 * series of template file suggestions. If none are found, the default
 * block.tpl.php is used.
 *
 * Most themes utilize their own copy of block.tpl.php. The default is located
 * inside "modules/block/block.tpl.php". Look in there for the full list of
 * variables.
 *
 * The $variables array contains the following arguments:
 * - $block
 *
 * @see block.tpl.php
 */
function scsmetronic_subtheme_preprocess_page(&$variables)
{
    global $user;
    if (variable_get('scsmetronic_redirect_to_login') && $user->uid == 0 && arg(0) != 'user') {
        //header('Location: ' . url('user/login', array( 'absolute' => TRUE)), TRUE, 302);
        // Handle redirection to the login form.
        // using drupal_goto() with destination set causes a recursive redirect loop
        $login_path = 'user/login';
        $code = 302;
        // The code in drupal_get_destination() doesn't preserve any query string
        // on 403 pages, so reproduce the part we want here.
        $path = isset($_GET['destination']) ? $_GET['destination'] : '<front>';
        $query = drupal_http_build_query(drupal_get_query_parameters(NULL, array('q', 'destination')));
        if ($query != '') {
            $path .= '?' . $query;
        }
        $destination = array('destination' => $path);
        header('Location: ' . url($login_path, array('query' => $destination, 'absolute' => TRUE)), TRUE, 302);
        drupal_exit();
    }
    $variables['navbar_top'] = 'navbar-static-top';
    $theme_header = theme_get_setting('theme_header', 'scsmetronic');
    if (!empty($theme_header) && $theme_header !== 'default') {
        $variables['navbar_top'] = 'navbar-fixed-top';
    }
    //Get the entire main menu tree
    $main_menu_name = theme_get_setting('theme_main_menu', 'scsmetronic');
    $main_menu_tree = menu_tree_all_data($main_menu_name);
    $user_menu_tree = menu_tree_all_data('user-menu');
    //Add the rendered output to the $main_menu_expanded variable
    $variables['main_menu_expanded'] = menu_tree_output($main_menu_tree);
    $variables['user_menu_expanded'] = menu_tree_output($user_menu_tree);
    if ($modal_form_paths = theme_get_setting('theme_modal')) {
        $modal_forms = explode("\r\n", $modal_form_paths);
        drupal_add_js(array('scsmetronic_forms_modal' => $modal_forms), 'setting');
    }
    if ($user->uid) {
        $name = theme('username', array('account' => $user, 'link_path' => NULL));
    } else {
        $name = variable_get('anonymous', t('Guest'));
    }
    $variables['loggedin_user_name'] = $name;
    $variables['image'] = scsmetronic_login_user_image($user);
}
开发者ID:Thomsonaj,项目名称:Ken,代码行数:61,代码来源:template.php

示例3: qualiceutics__topbar_main_menu

/**
 * Implements theme_links() targeting the main menu topbar.
 * Override base template, which would add the class of "left",which  we don't need
 */
function qualiceutics__topbar_main_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu')));
    $output = _zurb_foundation_links($links);
    return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
}
开发者ID:CTH12,项目名称:qualiceutics,代码行数:11,代码来源:template.php

示例4: mdl_links__topbar_secondary_menu

/**
 * Implements theme_links() targeting the secondary menu topbar.
 */
function mdl_links__topbar_secondary_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu')));
    $output = _mdl_links($links);
    return '<nav' . drupal_attributes($variables['attributes']) . '>' . $output . '</nav>';
}
开发者ID:zacdavidm,项目名称:mdl,代码行数:10,代码来源:template.php

示例5: msd15_preprocess_page

/**
 * Preprocessor for page.tpl.php template file.
 */
function msd15_preprocess_page(&$vars, $hook)
{
    // Get the entire main menu tree
    $main_menu_tree = menu_tree_all_data('main-menu');
    $vars['menu_tree_all_data'] = $main_menu_tree;
    // Add the rendered output to the $main_menu_expanded variable
    $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree);
    if (isset($vars['node']->type)) {
        // We don't want to apply this on taxonomy or view pages
        // Splice (2) is based on existing default suggestions. Change it if you need to.
        array_splice($vars['theme_hook_suggestions'], -1, 0, 'page__' . $vars['node']->type);
        // Get the url_alias and make each item part of an array
        $url_alias = drupal_get_path_alias($_GET['q']);
        $split_url = explode('/', $url_alias);
        // Add the full path template pages
        // Insert 2nd to last to allow page--node--[nid] to be last
        $cumulative_path = '';
        foreach ($split_url as $path) {
            $cumulative_path .= '__' . $path;
            $path_name = 'page' . $cumulative_path;
            array_splice($vars['theme_hook_suggestions'], -1, 0, str_replace('-', '_', $path_name));
        }
        // This does just the page name on its own & is considered more specific than the longest path
        // (because sometimes those get too long)
        // Also we don't want to do this if there were no paths on the URL
        // Again, add 2nd to last to preserve page--node--[nid] if we do add it in
        if (count($split_url) > 1) {
            $page_name = end($split_url);
            array_splice($vars['theme_hook_suggestions'], -1, 0, 'page__' . str_replace('-', '_', $page_name));
        }
    }
}
开发者ID:patpaev,项目名称:benvs15,代码行数:35,代码来源:template.php

示例6: drupalcampbelgium_links__topbar_secondary_menu

/**
 * Implements theme_links() targeting the secondary menu topbar.
 */
function drupalcampbelgium_links__topbar_secondary_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu')));
    $output = _zurb_foundation_links($links);
    $variables['attributes']['class'][] = 'center-buttons';
    return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
}
开发者ID:soniCaH,项目名称:drupalcamp-2015,代码行数:11,代码来源:template.php

示例7: fever_preprocess_page

function fever_preprocess_page(&$vars)
{
    // ....
    // Get the entire main menu tree
    $main_menu_tree = menu_tree_all_data('main-menu');
    // Add the rendered output to the $main_menu_expanded variable
    $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree);
}
开发者ID:rlhardrock,项目名称:drupalxtr,代码行数:8,代码来源:template.php

示例8: courage_admin_preprocess_page

function courage_admin_preprocess_page(&$variables)
{
    $main_menu_tree = menu_tree_all_data('management');
    $link = array('#theme' => 'item_list', '#items' => array(l('Home', url('<front>'))));
    $link['home'] = array('#theme' => 'link', '#text' => t('Home'), '#path' => '<front>', '#options' => array('attributes' => array(), 'html' => TRUE));
    $main_menu_output = menu_tree_output($main_menu_tree);
    array_unshift($main_menu_output, $link);
    $variables['primary_main_menu'] = render($main_menu_output);
}
开发者ID:picpen,项目名称:dentalevents,代码行数:9,代码来源:template.php

示例9: carpediem_process_page

/**
 * Display submenu on menu items.
 */
function carpediem_process_page(&$variables)
{
    // Array with the names of the menus
    $menu_names = array('menu-logopedie', 'menu-kinesitherapie');
    foreach ($menu_names as $menu_name) {
        $menu_tree = menu_tree_all_data($menu_name);
        $variables[$menu_name] = menu_tree_output($menu_tree);
    }
}
开发者ID:AnneliesVDWee,项目名称:drupal_carpediem,代码行数:12,代码来源:template.php

示例10: _bootstrap_book_children

/**
 * Formats the menu links for the child pages of the current page.
 *
 * @param array $book_link
 *   A fully loaded menu link that is part of the book hierarchy.
 *
 * @return string
 *   HTML for the links to the child pages of the current page.
 */
function _bootstrap_book_children($book_link)
{
    // Rebuild entire menu tree for the book.
    $tree = menu_build_tree($book_link['menu_name']);
    $tree = menu_tree_output($tree);
    // Fix the theme hook suggestions.
    _bootstrap_book_fix_theme_hooks($book_link['nid'], $tree);
    // Return the rendered output.
    return drupal_render($tree);
}
开发者ID:PixelGarage,项目名称:hso2,代码行数:19,代码来源:book-navigation.vars.php

示例11: spacelab_preprocess_page

/**
 * Preprocess variables for page template.
 */
function spacelab_preprocess_page(&$vars)
{
    // Get the entire main menu tree.
    $main_menu_tree = array();
    $main_menu_tree = menu_tree_all_data('main-menu', NULL, 2);
    // Add the rendered output to the $main_menu_expanded variable.
    $vars['main_menu_expanded'] = menu_tree_output($main_menu_tree);
    // Always print the site name and slogan, but if they are toggled off, we'll
    // just hide them visually.
    $vars['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE;
    $vars['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
    if ($vars['hide_site_name']) {
        // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
        $vars['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
    }
    if ($vars['hide_site_slogan']) {
        // If toggle_site_slogan is FALSE, the site_slogan will be empty,
        // so we rebuild it.
        $vars['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
    }
    // Since the title and the shortcut link are both block level elements,
    // positioning them next to each other is much simpler with a wrapper div.
    if (!empty($vars['title_suffix']['add_or_remove_shortcut']) && $vars['title']) {
        // Add a wrapper div using title_prefix and title_suffix render elements.
        $vars['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100);
        $vars['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99);
        // Make sure the shortcut link is the first item in title_suffix.
        $vars['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
    }
    // If panels arent being used at all.
    $vars['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page());
    // Check if we're to always print the page title, even on panelized pages.
    $vars['always_show_page_title'] = theme_get_setting('always_show_page_title') ? TRUE : FALSE;
    /**
     * insert variables into page template.
     */
    if ($vars['page']['sidebar_first'] && $vars['page']['sidebar_second']) {
        $vars['sidebar_grid_class'] = 'col-md-3';
        $vars['main_grid_class'] = 'col-md-6';
    } elseif ($vars['page']['sidebar_first'] || $vars['page']['sidebar_second']) {
        $vars['sidebar_grid_class'] = 'col-md-3';
        $vars['main_grid_class'] = 'col-md-9';
    } else {
        $vars['main_grid_class'] = 'col-md-12';
    }
    if ($vars['page']['header_top_left'] && $vars['page']['header_top_right']) {
        $vars['header_top_left_grid_class'] = 'col-md-8';
        $vars['header_top_right_grid_class'] = 'col-md-4';
    } elseif ($vars['page']['header_top_right'] || $vars['page']['header_top_left']) {
        $vars['header_top_left_grid_class'] = 'col-md-12';
        $vars['header_top_right_grid_class'] = 'col-md-12';
    }
}
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:56,代码来源:template.php

示例12: townsquare_bootstrap_preprocess_page

/**
 * Implements theme_preprocess_page().
 */
function townsquare_bootstrap_preprocess_page(&$vars)
{
    global $user;
    $vars['primary_local_tasks'] = menu_primary_local_tasks();
    $vars['secondary_local_tasks'] = menu_secondary_local_tasks();
    // The following menu stuff is lame
    foreach ($vars['main_menu'] as $item => $options) {
        $vars['main_menu'][$item]['html'] = TRUE;
        $vars['main_menu'][$item]['attributes']['id'] = 'menu-link-' . drupal_clean_css_identifier($options['href']);
    }
    $admin_menu = menu_tree_all_data('management');
    $children = array_pop($admin_menu);
    if ($children) {
        foreach ($children['below'] as $key => $value) {
            $children['below'][$key]['below'] = array();
        }
        $vars['admin_menu'] = menu_tree_output($children['below']);
    }
    // Add user picture if logged in
    if ($user->uid) {
        $vars['user_name'] = check_plain($user->name);
        if (!empty($user->picture)) {
            if (is_numeric($user->picture)) {
                $user->picture = file_load($user->picture);
            }
            if (!empty($user->picture->uri)) {
                $filepath = $user->picture->uri;
            }
        } elseif (variable_get('user_picture_default', '')) {
            $filepath = variable_get('user_picture_default', '');
        }
        if (isset($filepath)) {
            $alt = t("@user's picture", array('@user' => format_username($user)));
            if (module_exists('image') && file_valid_uri($filepath) && ($style = variable_get('user_picture_style', ''))) {
                $vars['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
            } else {
                $vars['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt));
            }
        } else {
            $vars['user_picture'] = '<i class="icon-user"></i>';
        }
    } else {
        unset($vars['secondary_menu']);
        $vars['login'] = drupal_get_form('user_login_block');
    }
    // Add Bootstrap
    $path = libraries_get_path('bootstrap');
    drupal_add_css($path . '/css/bootstrap.css');
    drupal_add_css($path . '/css/bootstrap-responsive.css');
    drupal_add_js($path . '/js/bootstrap.js');
    $path = libraries_get_path('font-awesome');
    drupal_add_css($path . '/css/font-awesome.css');
}
开发者ID:nningego,项目名称:townsquare,代码行数:56,代码来源:template.php

示例13: spartan_preprocess_region

/**
 * Implements hook_preprocess_region().
 */
function spartan_preprocess_region(&$vars)
{
    global $language;
    switch ($vars['region']) {
        // Menu region.
        case 'menu':
            $footer_menu_cache = cache_get("footer_menu_data:" . $language->language);
            if ($footer_menu_cache) {
                $footer_menu = $footer_menu_cache->data;
            } else {
                $footer_menu = menu_tree_output(_spartan_menu_build_tree('main-menu', array('max_depth' => 2)));
                cache_set("footer_menu_data:" . $language->language, $footer_menu);
            }
            //set the active trail
            $active_trail = menu_get_active_trail();
            foreach ($active_trail as $trail) {
                if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) {
                    $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail';
                }
            }
            $vars['dropdown_menu'] = $footer_menu;
            break;
            // Default footer content.
        // Default footer content.
        case 'footer_first':
            $footer_menu_cache = cache_get("footer_menu_data:" . $language->language);
            if ($footer_menu_cache) {
                $footer_menu = $footer_menu_cache->data;
            } else {
                $footer_menu = menu_tree_output(_spartan_menu_build_tree('main-menu', array('max_depth' => 2)));
                cache_set("footer_menu_data:" . $language->language, $footer_menu);
            }
            //set the active trail
            $active_trail = menu_get_active_trail();
            foreach ($active_trail as $trail) {
                if (isset($trail['mlid']) && isset($footer_menu[$trail['mlid']])) {
                    $footer_menu[$trail['mlid']]['#attributes']['class'][] = 'active-trail';
                }
            }
            $vars['footer_menu'] = $footer_menu;
            $vars['site_name'] = $site_name = variable_get('site_name');
            $vars['footer_logo'] = l(theme('image', array('path' => drupal_get_path('theme', 'spartan') . "/logo-sm.png", 'alt' => "{$site_name} logo")), '', array("html" => TRUE, 'attributes' => array('class' => 'logo')));
            if (function_exists('defaultcontent_get_node') && ($node = defaultcontent_get_node("email_update"))) {
                $node = node_view($node);
                $vars['subscribe_form'] = $node['webform'];
            }
            //krumo($vars['footer_menu']);
            break;
    }
}
开发者ID:jeffanthony,项目名称:openpublic-drops-7,代码行数:53,代码来源:template.php

示例14: innovation_preprocess_block

/**
 * Override or insert variables into the page template.
 *
 * Implements template_process_block().
 */
function innovation_preprocess_block(&$variables)
{
    $block = $variables['block'];
    if ($block->delta == 'main-menu' && $block->module == 'system' && $block->status == 1 && ($block->theme = 'innovation')) {
        // Get the entire main menu tree.
        $main_menu_tree = array();
        $main_menu_tree = menu_tree_all_data('main-menu', NULL, 2);
        // Add the rendered output to the $main_menu_expanded variable.
        //
        $main_menu_asu = menu_tree_output($main_menu_tree);
        $pri_attributes = array('class' => array('nav', 'navbar-nav', 'links', 'clearfix'));
        $variables['content'] = theme('links__system_main_menu', array('links' => $main_menu_asu, 'attributes' => $pri_attributes, 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
        $block->subject = '';
    }
}
开发者ID:sourfacedcyclop,项目名称:webspark-drops-drupal7,代码行数:20,代码来源:template.php

示例15: metroblocks_links__topbar_main_menu

/**
 * Implements theme_links() targeting the main menu specifically.
 * Formats links for Top Bar http://foundation.zurb.com/docs/components/top-bar.html
 */
function metroblocks_links__topbar_main_menu($variables)
{
    // We need to fetch the links ourselves because we need the entire tree.
    $links = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu')));
    $i = 1;
    foreach ($links as $key => $value) {
        if (is_numeric($key)) {
            $links[$key]['#attributes']['class'][] = 'color-' . $i;
            $i++;
        }
    }
    $output = _metroblocks_links($links);
    //$variables['attributes']['class'][] = 'right';
    return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
}
开发者ID:Alexabr23,项目名称:bomberos120,代码行数:19,代码来源:template.php


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