コード例 #1
0
/**
 * Generate the HTML representing a given menu item ID as a tab.
 *
 * @param $mid
 *   The menu ID to render.
 * @param $active
 *   Whether this tab or a subtab is the active menu item.
 * @param $primary
 *   Whether this tab is a primary tab or a subtab.
 *
 * @ingroup themeable
 */
function art_menu_local_task($mid, $active, $primary)
{
    $active_class = "";
    if ($active) {
        $active_class .= "active ";
    }
    $link = menu_item_link($mid, FALSE);
    $output = '<span class="' . $active_class . 'art-button-wrapper">' . '<span class="art-button-l"></span>' . '<span class="art-button-r"></span>' . '<a href="?q=' . $link['href'] . '" class="' . $active_class . 'art-button">' . $link['title'] . '</a></span>';
    return '<li>' . $output . '</li>';
}
コード例 #2
0
/**
* Implementation of theme_menu_item().
*
* Add active class to current menu item links.
*/
function phptemplate_menu_item($mid, $children = '', $leaf = TRUE)
{
    $item = menu_get_item($mid);
    // get current menu item
    $class = 'menu-' . str_replace(' ', '-', strtolower(str_replace('?', '', $item['title'])));
    $active_class = in_array($mid, _menu_get_active_trail()) ? ' active-trail' : '';
    // decide whether to add the active class to this menu item
    if (drupal_get_normal_path($item['path']) == $_GET['q'] || drupal_is_front_page() && $item['path'] == '<front>' || in_array($mid, _menu_get_active_trail())) {
        $active_class = ' active';
        // set active class
    } else {
        // otherwise...
        $active_class = '';
        // do nothing
    }
    return '<li class="' . ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) . $active_class . ' ' . $class . '">' . menu_item_link($mid) . $children . "</li>\n";
}
コード例 #3
0
function nostress_menu_local_task($mid, $active = FALSE)
{
    return '<li ' . ($active ? 'class="active" ' : '') . '><span><span>' . menu_item_link($mid) . "</span></span></li>\n";
}
コード例 #4
0
<?php

$link = menu_item_link($mid);
// replace spaces with "_", and strip HTML
$css_id = str_replace(' ', '_', strip_tags($link));
// render the menu link with unique CSS id.
$output = '<li id="' . $css_id . '" class="' . ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) . '">' . $link . $children . "</li>\n";
print $output;
コード例 #5
0
function framework_menu_item($mid, $children, $leaf)
{
    $active_class = menu_in_active_trail($mid) ? ' active' : '';
    return '<li class="' . ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) . $active_class . '">' . menu_item_link($mid) . $children . "</li>\n";
}