Projet

Général

Profil

Paste
Télécharger (978 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / bootstrap / theme / bootstrap / bootstrap-accordion.func.php @ 87dbc3bf

1
<?php
2
/**
3
 * @file
4
 * bootstrap-accordion.func.php
5
 * @todo replace this with bootstrap_panel?
6
 */
7

    
8
/**
9
 * Implements theme_bootstrap_bare().
10
 */
11
function bootstrap_bootstrap_accordion($variables) {
12
  $elements = $variables['elements'];
13

    
14
  if (empty($variables['id'])) {
15
    $accordion_id = 'accordion-' . md5($elements);
16
  }
17
  else {
18
    $accordion_id = check_plain($variables['id']);
19
  }
20
  $output = '<div class="accordion" id="' . $accordion_id . '">';
21
  foreach ($elements as $id => $item) {
22
    $output .= '<div class="accordion-group"><div class="accordion-heading">';
23
    $output .= '<a class="accordion-toggle" data-toggle="collapse" data-parent="#' . $accordion_id . '" href="#' . $id . '">' . check_plain($item['header']) . '</a></div>';
24
    $output .= '<div id="' . $id . '" class="accordion-body collapse in"><div class="accordion-inner">';
25
    $output .= render($item['content']);
26
    $output .= '</div></div></div>';
27
  }
28
  $output .= '</div>';
29
  return $output;
30
}