function theme_links__ctools_dropbutton

Create a dropbutton menu.

Parameters

$title: The text to place in the clickable area to activate the dropbutton. This text is indented to -9999px by default.

$links: A list of links to provide within the dropbutton, suitable for use in via Drupal's theme('links').

$image: If true, the dropbutton link is an image and will not get extra decorations that a text dropbutton link will.

$class: An optional class to add to the dropbutton's container div to allow you to style a single dropbutton however you like without interfering with other dropbuttons.

4 theme calls to theme_links__ctools_dropbutton()
ctools_custom_content_ui::list_build_row in ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php
Build a row based on the item.
ctools_export_ui::list_build_row in plugins/export_ui/ctools_export_ui.class.php
Build a row based on the item.
page_manager_get_pages in page_manager/page_manager.admin.inc
Sort tasks into buckets based upon whether or not they have subtasks.
stylizer_ui::list_build_row in stylizer/plugins/export_ui/stylizer_ui.class.php
Build a row based on the item.

File

includes/dropbutton.theme.inc, line 72

Code

function theme_links__ctools_dropbutton($vars) {
    // Check to see if the number of links is greater than 1;
    // otherwise just treat this like a button.
    if (!empty($vars['links'])) {
        $is_drop_button = count($vars['links']) > 1;
        // Add needed files.
        if ($is_drop_button) {
            ctools_add_js('dropbutton');
            ctools_add_css('dropbutton');
        }
        ctools_add_css('button');
        // Provide a unique identifier for every button on the page.
        static $id = 0;
        $id++;
        // Wrapping div.
        $class = 'ctools-no-js';
        $class .= $is_drop_button ? ' ctools-dropbutton' : '';
        $class .= ' ctools-button';
        if (!empty($vars['class'])) {
            $class .= $vars['class'] ? ' ' . implode(' ', $vars['class']) : '';
        }
        $output = '';
        $output .= '<div class="' . $class . '" id="ctools-button-' . $id . '">';
        // Add a twisty if this is a dropbutton.
        if ($is_drop_button) {
            $vars['title'] = $vars['title'] ? check_plain($vars['title']) : t('open');
            $output .= '<div class="ctools-link">';
            if ($vars['image']) {
                $output .= '<a href="#" class="ctools-twisty ctools-image"><span class="element-invisible">' . $vars['title'] . '</span></a>';
            }
            else {
                $output .= '<a href="#" class="ctools-twisty ctools-text"><span class="element-invisible">' . $vars['title'] . '</span></a>';
            }
            // ctools-link.
            $output .= '</div>';
        }
        // The button content.
        $output .= '<div class="ctools-content">';
        // Check for attributes. theme_links expects an array().
        $vars['attributes'] = !empty($vars['attributes']) ? $vars['attributes'] : array();
        // Remove the inline and links classes from links if they exist.
        // These classes are added and styled by Drupal core and mess up the default
        // styling of any link list.
        if (!empty($vars['attributes']['class'])) {
            $classes = $vars['attributes']['class'];
            foreach ($classes as $key => $class) {
                if ($class === 'inline' || $class === 'links') {
                    unset($vars['attributes']['class'][$key]);
                }
            }
        }
        // Call theme_links to render the list of links.
        $output .= theme_links(array(
            'links' => $vars['links'],
            'attributes' => $vars['attributes'],
            'heading' => '',
        ));
        $output .= '</div>';
        // ctools-content.
        $output .= '</div>';
        // ctools-dropbutton.
        return $output;
    }
    else {
        return '';
    }
}