本文整理汇总了PHP中menu_tree函数的典型用法代码示例。如果您正苦于以下问题:PHP menu_tree函数的具体用法?PHP menu_tree怎么用?PHP menu_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了menu_tree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: responsive_green_preprocess_page
/**
* Override or insert variables into the page template.
*/
function responsive_green_preprocess_page(&$vars)
{
if (isset($vars['main_menu'])) {
$vars['main_menu'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu', 'clearfix')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['main_menu'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_menu'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu', 'clearfix')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['secondary_menu'] = FALSE;
}
if (module_exists('i18n_menu')) {
$vars['main_menu_tree'] = i18n_menu_translated_tree(variable_get('menu_main_links_source', 'main-menu'));
} else {
$vars['main_menu_tree'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
}
$vars['twitter'] = theme_get_setting('twitter', 'responsive_green');
$vars['facebook'] = theme_get_setting('facebook', 'responsive_green');
$vars['googleplus'] = theme_get_setting('googleplus', 'responsive_green');
$vars['linkedin'] = theme_get_setting('linkedin', 'responsive_green');
$vars['theme_path_social'] = base_path() . drupal_get_path('theme', 'responsive_green');
$vars['display'] = theme_get_setting('display', 'responsive_green');
$vars['sdisplay'] = theme_get_setting('sdisplay', 'responsive_green');
$vars['img1'] = base_path() . drupal_get_path('theme', 'responsive_green') . '/images/slide-image-1.jpg';
$vars['img2'] = base_path() . drupal_get_path('theme', 'responsive_green') . '/images/slide-image-2.jpg';
$vars['img3'] = base_path() . drupal_get_path('theme', 'responsive_green') . '/images/slide-image-3.jpg';
}
示例2: unity_lab_links__system_main_menu
function unity_lab_links__system_main_menu($vars)
{
$menu_name = variable_get('menu_main_links_source', 'main-menu');
$tree = menu_tree($menu_name);
$html = drupal_render($tree);
return $html;
}
示例3: partial__homepage_preprocess
/**
* Implements partial__{name}_preprocess().
*/
function partial__homepage_preprocess(&$variables)
{
// Not using Tableau for now
// drupal_add_js('https://public.tableau.com/javascripts/api/viz_v1.js', 'external');
$homepage_menu = menu_tree('menu-homepage');
$variables['homepage_menu'] = render($homepage_menu);
}
示例4: _myu_user_dropdown
function _myu_user_dropdown()
{
global $user;
global $language;
$items = array();
if ($user->uid === 0) {
$login_link = l('<span>' . t('Login') . '</span>', '', array('attributes' => array('class' => 'login dropdown-toggle', 'data-toggle' => 'modal'), 'fragment' => 'login', 'external' => TRUE, 'html' => TRUE));
return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $login_link . '</li></ul>';
} else {
$username = '';
if (!empty($user->picture)) {
$fid = $user->picture;
$file = file_load($fid);
$username = theme('image_style', array('path' => $file->uri, 'style_name' => '29x29', 'attributes' => array('class' => 'img-circle')));
}
$username .= '<span class="username username-hide-on-mobile">' . format_username($GLOBALS['user']) . '</span><i class="fa fa-angle-down"></i>';
$username_link = l($username, 'javascript:;', array('html' => TRUE, 'language' => $language, 'external' => TRUE, 'attributes' => array('class' => 'dropdown-toggle', 'data-close-others' => 'true', 'data-hover' => 'dropdown', 'data-toggle' => 'dropdown')));
$user_menu = menu_tree('user-menu');
foreach ($user_menu as $menu_link) {
if (isset($menu_link['#original_link'])) {
$items[] = l($menu_link['#original_link']['title'], $menu_link['#original_link']['href'], array('language' => $language));
}
}
$user_menu_list = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu dropdown-menu-default')));
return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $username_link . $user_menu_list . '</li></ul>';
}
}
示例5: deco_preprocess_page
function deco_preprocess_page(&$vars)
{
$vars['sidebar_triple'] = FALSE;
if (!empty($vars['page']['sidebar_second']) && !empty($vars['page']['sidebar_right_sec']) && !empty($vars['page']['sidebar_first'])) {
$vars['classes_array'][] .= ' sidebar-triple';
$vars['sidebar_triple'] = TRUE;
}
if (!empty($vars['page']['sidebar_right_sec']) && empty($vars['page']['sidebar_second'])) {
$vars['page']['sidebar_second'] = $vars['page']['sidebar_right_sec'];
$vars['page']['sidebar_right_sec'] = '';
}
// set variables for the logo and slogan
$site_fields = array();
if ($vars['site_name']) {
$site_fields[] = check_plain($vars['site_name']);
}
if ($vars['site_slogan']) {
$site_fields[] = '- ' . check_plain($vars['site_slogan']);
}
$vars['site_title'] = implode(' ', $site_fields);
if (isset($site_fields[0])) {
$site_fields[0] = '<span class="site-name">' . $site_fields[0] . '</span>';
}
if (isset($site_fields[1])) {
$site_fields[1] = '<span class="site-slogan">' . $site_fields[1] . '</span>';
}
$vars['site_title_html'] = implode(' ', $site_fields);
$vars['primary_menu'] = str_replace('class="menu"', 'class="links primary-links"', render(menu_tree(variable_get('menu_main_links_source', 'main-menu'))));
$vars['secondary_menu'] = str_replace('class="menu"', 'class="links secondary-links"', render(menu_tree(variable_get('menu_secondary_links_source', 'secondary-menu'))));
}
示例6: sky_preprocess_page
function sky_preprocess_page(&$variables, $hook)
{
// Add a page title variable using the site slogan on the front page
if (theme_get_setting('sky_title')) {
if ($variables['is_front'] && !is_null(variable_get('site_name', ''))) {
$variables['sky_title'] = variable_get('site_name', '');
} else {
$variables['sky_title'] = drupal_get_title();
}
}
// Add a transparent spacer image to the end of the footer message
$variables['footer_message'] .= theme('image', path_to_theme() . '/images/transparent.gif', 'spacer', 'spacer', array('style' => 'height:2em;'));
// How is the navigation aligned
$navigation_alignment = theme_get_setting('sky_nav_alignment');
// Prepare the menu markup for the Primary Links (make it a menu tree)
if ($variables['primary_links']) {
$pid = variable_get('menu_primary_links_source', 'primary-links');
$tree = menu_tree($pid);
$variables['primary_links'] = '<del class="wrap-' . $navigation_alignment . '">' . $tree . '</del>';
}
// Include advanced theme classes.
if (theme_get_setting('sky_themer_classes') == 1) {
include 'theme-classes.php';
$variables['body_tag'] = '<body' . $variables['body_css'] . '>';
} else {
$variables['body_tag'] = '<body class="' . $variables['layout'] . '">';
}
}
示例7: espresso_preprocess_html
function espresso_preprocess_html(&$variables)
{
module_load_include('inc', 'designssquare_lib', 'includes/template_api');
//for header tapi
module_load_include('module', 'designssquare_lib');
//for menu block
$reqUrl = $_GET['q'];
//header menu
$variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
//footer menu
$variables['bottom_nav'] = menu_tree('menu-bottom-menu');
$variables['bottom_nav']['#theme_wrappers'] = array('menu_tree__bottom');
// _default_css();
// _default_js();
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))) {
// $widget = 'field_widgets';
// $widget_list = field_get_items('node', $node, 'field_widgets');
// (is_array($widget_list) && count($widget_list)) ? _add_widgets($widget_list, $node) : '';
}
$variables['head_tapi'] = _header_tapi_site($variables);
//remove classes from body tag
$variables['classes_array'] = array();
//making regions available in html scope
include_blocks($variables, 'html');
//make contact template api available
// $variables['contact_tapi'] = _contact_tapi();
//retrieve header and background images
// $variables['header_img'] = _header_img();
// $variables['background_img'] = _background_img();
//Custom Theme Settings
$variables['espresso_bg_img'] = _background_img();
// $variables['espresso_bg_img'] = variable_get('ds_theme_predefined_background',theme_get_setting('ds_theme_predefined_background')).'.jpg';
//adding styles
drupal_add_css(path_to_theme() . '/assets/css/custom.css', array('group' => CSS_THEME + 2, 'type' => 'file'));
}
示例8: phptemplate_primary
/**
* Return a cascade primary links.
* Clone implementation from user_block().
*
* @return
* a themed cascade primary links.
*/
function phptemplate_primary()
{
$output = '<div id="primary-links-region">';
$output .= menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
$output .= '</div>';
return $output;
}
示例9: nub_core_preprocess_page
/**
* Implementation of preprocess_page().
*/
function nub_core_preprocess_page(&$vars)
{
$html_attr = array();
$html_attr['lang'] = $vars['language']->language;
$html_attr['dir'] = $vars['language']->dir;
$vars['html_attr'] = array_filter($html_attr);
$body_attr = array();
$body_attr['class'] = $vars['body_classes'];
$vars['body_attr'] = array_filter($body_attr);
// Theme primary and secondary menu.
$vars['primary_links'] = !empty($vars['primary_links']) ? menu_tree(variable_get('menu_primary_links_source', 'primary-links')) : "";
$vars['secondary_links'] = !empty($vars['secondary_links']) ? theme('links', $vars['secondary_links'], array('class' => 'menu')) : "";
// Split primary and secondary local tasks
$vars['tabs_primary'] = theme('menu_local_tasks', 'primary');
$vars['tabs_secondary'] = theme('menu_local_tasks', 'secondary');
// Branding
$logo_path = ltrim($vars['logo'], '/');
$vars['logo_linked'] = file_exists($logo_path) ? l(theme('image', $logo_path, $vars['site_name'] . ' logo'), '<front>', array('html' => TRUE, 'attributes' => array('class' => 'site-logo', 'title' => 'Back to home'))) : '';
$vars['site_name_linked'] = l($vars['site_name'], '<front>', array('attributes' => array('title' => 'Back to home')));
// Skip navigation links (508).
$vars['skip_nav'] = '<a id="skip-nav" class="anchorLink" href="#main">' . t('Skip navigation') . '</a>';
// Back to top.
$vars['back_to_top'] = '<a id="back-to-top" class="anchorLink" href="#header">' . t('↑ Back to top') . '</a>';
// Copyright text
$vars['copyright'] = "© " . date("Y") . " " . $vars['site_name'] . '.';
// Remove duplicate content-type header -- see http://drupal.org/node/451304
$vars['head'] = drupal_set_html_head();
}
示例10: iha_preprocess_page
function iha_preprocess_page(&$variables)
{
$search_box = drupal_render(drupal_get_form('search_form'));
$variables['search_box'] = $search_box;
if (drupal_is_front_page()) {
unset($variables['page']['content']['system_main']['default_message']);
//will remove message "no front page content is created"
drupal_set_title('');
//removes welcome message (page title)
}
if (arg(0) == 'node') {
$variables['node_content'] =& $variables['page']['content']['system_main']['nodes'][arg(1)];
}
if (isset($variables['node']->type)) {
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
}
// Prepare the mobile menu.
$user_menu = menu_tree('user-menu');
$main_menu = menu_tree('main-menu');
$menu_tree = array_merge($main_menu, $user_menu);
// FYI for future dev's - If need to add more menu items, then load the other menu through menu tree as well and do a
// array merge or for loop to attach the items to the $menu_tree.
$mobile_menu = '<ul class="list-unstyled main-menu">';
foreach ($menu_tree as $mlid => $mm) {
if (is_int($mlid)) {
$mobile_menu .= iha_render_mobile_menu($mm);
}
}
$mobile_menu .= '</ul>';
$variables['mobile_menu'] = $mobile_menu;
}
示例11: arthemia_primary
/**
* Return a full tree of the expanded menu. Thank you multiflex-3 for this code!
*/
function arthemia_primary()
{
$output = '<div id="page-bar">';
$output .= menu_tree(variable_get('menu_primary_links_source', 'primary-links'));
$output .= '</div>';
return $output;
}
示例12: superhero_preprocess_page
/**
* Preprocess Page
*/
function superhero_preprocess_page(&$vars)
{
$theme = superhero_get_theme();
$theme->page =& $vars;
$vars['attributes_array']['class'] = array('body');
// Primary nav
$vars['primary_nav'] = FALSE;
if ($vars['main_menu']) {
// Build links
$vars['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
// Provide default theme wrapper function
$vars['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
}
$default_preset = $theme->settings['default_preset'];
$force = false;
$superhero_base_url = variable_get('superhero_base_url', '');
global $base_url;
if ($superhero_base_url != $base_url) {
$force = true;
}
variable_set('superhero_base_url', $base_url);
require_once dirname(__FILE__) . '/includes/superhero_scss.php';
$scss = new Superhero_scss($theme);
if (!file_exists('public://css')) {
drupal_mkdir('public://css');
}
$file = $scss->outputFile('public://css/' . $theme->theme . '-theme-preset' . ($default_preset + 1) . '.css', $force);
drupal_add_css($file, array('type' => 'file', 'group' => CSS_THEME));
}
示例13: stability_process_page
/**
* Implementation of hook_preprocess_page().
*/
function stability_process_page(&$variables)
{
global $user;
$variables['login_account_links'] = '';
if (theme_get_setting('login_account_links') || module_exists('uc_cart')) {
$output = '';
if (theme_get_setting('login_account_links')) {
$output .= '<span class="login">
<i class="fa fa-lock"></i> ' . l($user->uid ? t('My Account') : t('Login'), 'user') . '
</span>';
$output .= $user->uid ? '<span class="logout"><i class="fa fa-sign-out"></i> ' . l(t('Logout'), 'user/logout') . '</span>' : '';
$output .= !$user->uid ? '<span class="register"><i class="fa fa-pencil-square-o"></i>' . t('Not a Member?') . ' ' . l(t('Register'), 'user/register') . '</span>' : '';
}
if (module_exists('uc_cart')) {
$output .= '<span class="cart">
<i class="fa fa-shopping-cart"></i> ' . l(t('Shopping Cart'), 'cart') . '
</span>';
}
$variables['login_account_links'] = '
<div class="header-top-right">
' . $output . '
</div>';
}
$header_top_menu_tree = module_exists('i18n_menu') ? i18n_menu_translated_tree('menu-header-top-menu') : menu_tree('menu-header-top-menu');
$variables['header_top_menu_tree'] = drupal_render($header_top_menu_tree);
// Process Slideshow Sub Header
if (theme_get_setting('sub_header') == 5 || arg(2) == 'sub-header' && arg(3) == '5') {
drupal_add_js(drupal_get_path('theme', 'stability') . '/vendor/jquery.glide.min.js');
}
if (theme_get_setting('retina')) {
drupal_add_js(drupal_get_path('theme', 'stability') . '/vendor/jquery.retina.js');
}
drupal_add_js(array('stability' => array('flickr_id' => theme_get_setting('flickr_id'), 'logo_sticky' => theme_get_setting('logo_sticky'))), 'setting');
}
示例14: k373k_links
/**
Draw menu.
*/
function k373k_links($variables) {
if (array_key_exists('id', $variables['attributes']) && $variables['attributes']['id'] == 'main-menu-links') {
$pid = variable_get('menu_main_links_source', 'main-menu');
$tree = menu_tree($pid);
return drupal_render($tree);
}
return theme_links($variables);
}
示例15: solsud_links
/**
* Implements theme_links().
*/
function solsud_links($variables)
{
if (array_key_exists('id', $variables['attributes']) && $variables['attributes']['id'] == 'main-menu-links') {
$tree = menu_tree('main-menu');
return drupal_render($tree);
}
return theme_links($variables);
}