[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/ctools/includes/ -> collapsible.theme.inc (source)

   1  <?php
   2  // $Id: collapsible.theme.inc,v 1.5 2009/09/10 13:43:11 merlinofchaos Exp $
   3  
   4  /**
   5   * @file
   6   * Theme function for the collapsible div tool.
   7   *
   8   * Call theme('ctools_collapsible', $handle, $content, $collapsed) to draw the
   9   * div. The theme function is not necessary; you can add the classes, js and css
  10   * yourself if you really want to.
  11   */
  12  
  13  /**
  14   * Delegated implementation of hook_theme()
  15   */
  16  function ctools_collapsible_theme(&$items) {
  17    $items['ctools_collapsible'] = array(
  18      'arguments' => array('handle' => NULL, 'content' => NULL, 'collapsed' => FALSE),
  19      'file' => 'includes/collapsible.theme.inc',
  20    );
  21    $items['ctools_collapsible_remembered'] = array(
  22      'arguments' => array('id' => NULL, 'handle' => NULL, 'content' => NULL, 'collapsed' => FALSE),
  23      'file' => 'includes/collapsible.theme.inc',
  24    );
  25  }
  26  
  27  /**
  28   * Render a collapsible div.
  29   *
  30   * @param $handle
  31   *   Text to put in the handle/title area of the div.
  32   * @param $content
  33   *   Text to put in the content area of the div, this is what will get
  34   *   collapsed
  35   * @param $collapsed = FALSE
  36   *   If true, this div will start out collapsed.
  37   */
  38  function theme_ctools_collapsible($handle, $content, $collapsed = FALSE) {
  39    ctools_add_js('collapsible-div');
  40    ctools_add_css('collapsible-div');
  41  
  42    $class = $collapsed ? ' ctools-collapsed' : '';
  43    $output = '<div class="ctools-collapsible-container' . $class . '">';
  44    $output .= '<div class="ctools-collapsible-handle">' . $handle . '</div>';
  45    $output .= '<div class="ctools-collapsible-content">' . $content . '</div>';
  46    $output .= '</div>';
  47  
  48    return $output;
  49  }
  50  
  51  /**
  52   * Render a collapsible div whose state will be remembered.
  53   *
  54   * @param $id
  55   *   The CSS id of the container. This is required.
  56   * @param $handle
  57   *   Text to put in the handle/title area of the div.
  58   * @param $content
  59   *   Text to put in the content area of the div, this is what will get
  60   *   collapsed
  61   * @param $collapsed = FALSE
  62   *   If true, this div will start out collapsed.
  63   */
  64  function theme_ctools_collapsible_remembered($id, $handle, $content, $collapsed = FALSE) {
  65    ctools_add_js('collapsible-div');
  66    ctools_add_css('collapsible-div');
  67  
  68    $class = $collapsed ? ' ctools-collapsed' : '';
  69    $output = '<div id="' . $id . '" class="ctools-collapsible-remember ctools-collapsible-container' . $class . '">';
  70    $output .= '<div class="ctools-collapsible-handle">' . $handle . '</div>';
  71    $output .= '<div class="ctools-collapsible-content">' . $content . '</div>';
  72    $output .= '</div>';
  73  
  74    return $output;
  75  }
  76  


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7