123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php
- function ctools_dropbutton_theme(&$items) {
- $items['links__ctools_dropbutton'] = array(
- 'variables' => array('title' => NULL, 'links' => NULL, 'image' => FALSE, 'class' => NULL),
- 'file' => 'includes/dropbutton.theme.inc',
- );
- }
- function theme_links__ctools_dropbutton($vars) {
-
-
- if (!empty($vars['links'])) {
- $is_drop_button = (count($vars['links']) > 1);
-
- if ($is_drop_button) {
- ctools_add_js('dropbutton');
- ctools_add_css('dropbutton');
- }
- ctools_add_css('button');
-
- static $id = 0;
- $id++;
-
- $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 . '">';
-
- 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">' . $vars['title'] . '</a>';
- }
- else {
- $output .= '<a href="#" class="ctools-twisty ctools-text">' . $vars['title'] . '</a>';
- }
- $output .= '</div>';
- }
-
- $output .= '<div class="ctools-content">';
-
- $vars['attributes'] = (!empty($vars['attributes'])) ? $vars['attributes'] : array();
-
-
-
- if (!empty($vars['attributes']['class'])) {
- $classes = $vars['attributes']['class'];
- foreach ($classes as $key => $class) {
- if ($class === 'inline' || $class === 'links') {
- unset($vars['attributes']['class'][$key]);
- }
- }
- }
-
- $output .= theme_links(array('links' => $vars['links'], 'attributes' => $vars['attributes'], 'heading' => ''));
- $output .= '</div>';
- $output .= '</div>';
- return $output;
- }
- else {
- return '';
- }
- }
|