You are here

function _rules_filter_operations_dropdown in Rules filter 7

Output given links as ctools dropdown menu.

Note: we don't use native ctools theme function because it needs not rendered links as input params, but in given rules table we have only already rendered links.

Parameters

array $links: An array of links.

Return value

string HTML of dropdown menu.

1 call to _rules_filter_operations_dropdown()
_rules_filter_rules_table_components in includes/pages.inc
Returns Tabs and Rules table.

File

includes/pages.inc, line 238
Page elements for the module.

Code

function _rules_filter_operations_dropdown(array $links) {

  // Add needed files.
  if (count($links) > 1) {
    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++;
  $output = '<div class="ctools-dropbutton ctools-button" id="ctools-button-' . $id . '">';

  // Open link.
  $output .= '<div class="ctools-link"><a href="#" class="ctools-twisty ctools-text"><span class="element-invisible">' . t('open') . '</span></a></div>';

  // The button content.
  $output .= '<div class="ctools-content">' . theme('item_list', array(
    'items' => $links,
  )) . '</div>';

  // Close ctools-dropbutton.
  $output .= '</div>';
  return $output;
}