本文整理汇总了PHP中menu_tree_all_data函数的典型用法代码示例。如果您正苦于以下问题:PHP menu_tree_all_data函数的具体用法?PHP menu_tree_all_data怎么用?PHP menu_tree_all_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了menu_tree_all_data函数的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;
}
}
}
示例2: navigation
public function navigation()
{
$primary_nav = $this->rebuildTree(menu_tree_all_data('main-menu'));
$secondary_nav = $this->rebuildTree(menu_tree_all_data('user-menu'));
echo '<div id="navbar" class="navbar navbar-default">';
echo '<div class="navbar-header">';
echo '<a class="logo navbar-btn pull-left" href="/">';
echo '<img src="/images/vleermuis-logo.png" alt="Vleermuiskasten.nl" />';
echo '</a>';
echo '<div class="search hidden-xs">';
echo '<form id="search">';
echo '<input type="text" name="search" placeholder="Zoeken">';
echo '<button type="submit"><i class="glyphicon glyphicon-search"></i></button>';
echo '</form>';
echo '</div>';
echo '<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">';
echo '<span class="sr-only">Navigatie openen</span>';
echo '<span class="icon-bar"></span>';
echo '<span class="icon-bar"></span>';
echo '<span class="icon-bar"></span>';
echo '</button>';
echo '</div>';
echo '<div class="navbar-collapse collapse">';
echo '<nav role="navigation">';
echo Nav::widget(['items' => $primary_nav, 'options' => ['class' => 'menu nav navbar-nav']]);
echo Nav::widget(['items' => $secondary_nav, 'options' => ['class' => 'menu nav navbar-nav']]);
echo '</nav>';
echo '</div>';
echo '</div>';
}
示例3: 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>';
}
示例4: 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>';
}
示例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));
}
}
}
示例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>';
}
示例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);
}
示例8: 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);
}
}
示例9: 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);
}
示例10: gwt_drupal_links__menu_auxiliary_menu
/**
* theme override of link auxiliary_menu
* TODO: create automatically an auxiliary_menu machine_name: menu-auxiliary-menu
*/
function gwt_drupal_links__menu_auxiliary_menu($variables)
{
$links = menu_tree_all_data('menu-auxiliary-menu', null, 4);
// print_r($links);
// heading not needed in main menu
$heading = $variables['heading'];
// global $language_url;
$output = '';
$output .= _gwt_drupal_link_render($links, 0, $variables);
return $output;
}
示例11: 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');
}
示例12: 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';
}
}
示例13: corporato_preprocess_page
function corporato_preprocess_page(&$variables)
{
$main_menu_tree = menu_tree_all_data('main-menu');
//$expanded = menu_tree_output($main_menu_tree);
//krumo($main_menu_tree);
//krumo($expanded);
$menuParent = array_slice(menu_get_active_trail(), 1);
//krumo($menuParent);
$output = '<ul>' . _process_menu_node($main_menu_tree, $menuParent) . '</ul>';
//krumo($output);
//krumo($expanded);
$variables['corporato_main_menu'] = $output;
}
示例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 = '';
}
}
示例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>';
}