Exemple #1
0
/**
 * 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>';
}
Exemple #2
0
/**
 * 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>';
}
Exemple #3
0
/**
 * Implements theme_links() with foundations split button markup.
 *
 * @param $variables
 *   An associative array containing:
 *   - links
 *     - An array of menu links.
 *   - attributes (optional)
 *     - class: Array of additional classes like large, alert, round
 *     - data-dropdown: Custom dropdown id.
 *
 * @return string
 *
 * Formats links for Split Button http://foundation.zurb.com/docs/components/split-buttons.html
 */
function zurb_foundation_links__split_button($variables)
{
    $links = $variables['links'];
    if (empty($variables['attributes']['class'])) {
        $variables['attributes']['class'] = array();
    }
    $variables['attributes']['class'][] = 'button';
    if (!isset($variables['attributes']['data-dropdown'])) {
        $variables['attributes']['data-dropdown'] = drupal_html_id('ddb');
    }
    $id = $variables['attributes']['data-dropdown'];
    unset($variables['attributes']['data-dropdown']);
    if (!isset($variables['label'])) {
        $variables['label'] = t('Split button');
    }
    $primary_link = array();
    $primary_link['#title'] = $variables['label'] . '<span data-dropdown="' . $id . '"></span>';
    $primary_link['#localized_options']['attributes']['class'][] = 'split';
    $primary_link['#localized_options']['html'] = TRUE;
    $primary_link['#localized_options']['fragment'] = $id;
    $primary_link['#localized_options']['attributes'] = array_merge_recursive($primary_link['#localized_options']['attributes'], $variables['attributes']);
    $primary_link = l($primary_link['#title'], '', $primary_link['#localized_options']);
    $output = _zurb_foundation_links($links);
    return $primary_link . '<ul id="' . $id . '" class="f-dropdown" data-dropdown-content>' . $output . '</ul>';
}