You are here

function theme_ctools_collapsible_remembered in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/collapsible.theme.inc \theme_ctools_collapsible_remembered()

Render a collapsible div whose state will be remembered.

Parameters

$id: The CSS id of the container. This is required.

$handle: Text to put in the handle/title area of the div.

$content: Text to put in the content area of the div, this is what will get collapsed.

$collapsed: If true, this div will start out collapsed.

File

includes/collapsible.theme.inc, line 63
Theme function for the collapsible div tool.

Code

function theme_ctools_collapsible_remembered($vars) {
  $id = $vars['id'];
  $handle = $vars['handle'];
  $content = $vars['content'];
  $collapsed = $vars['collapsed'];
  ctools_add_js('collapsible-div');
  ctools_add_css('collapsible-div');
  $class = $collapsed ? ' ctools-collapsed' : '';
  $output = '<div id="' . $id . '" class="ctools-collapsible-remember ctools-collapsible-container' . $class . '">';
  $output .= '<div class="ctools-collapsible-handle">' . $handle . '</div>';
  $output .= '<div class="ctools-collapsible-content">' . $content . '</div>';
  $output .= '</div>';
  return $output;
}