public static function accordion(array $groups, array $attributes = array()) {
        self::$accordions++;
        $collapse = 1;
        ob_start();
        ?>
        <div data-close="<?= @$attributes['close'] ?>" class="accordion <?= @$attributes['class'] ?>" id="accordion<?= self::$accordions ?>" <?= self::parseAttributes($attributes, array('class', 'id', 'close')) ?>>
            <?php
            foreach ($groups as $key => $group) {
                if (empty($group['heading']) || empty($group['body'])) {
                    throw new Exception('Each accordion group must have a heading and a body');
                }
                ?>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" data-toggle="collapse"
                           data-parent="#accordion<?= self::$accordions ?>"
                           href="#group-<?= self::$accordions . $key ?>">
                               <?= $group['heading'] ?>
                        </a>
                    </div>
                    <div class="accordion-body collapse in" id="group-<?= self::$accordions . $key ?>">
                        <div class="accordion-inner">
                            <?= $group['body'] ?>
                        </div>
                    </div>
                </div>
                <?php
                $collapse++;
            }
            ?>
        </div>
        <script>
            $(document).ready(function () {
                $('#accordion<?= self::$accordions ?>').collapse();
            })
        </script>
        <?php
        return ob_get_clean();
    }
public static function accordion(array $groups, array $attributes = array()) {
        self::$accordions++;
        $collapse = 1;
        ob_start();
        ?>
        <div data-close="<?= @$attributes['close'] ?>" class="accordion <?= @$attributes['class'] ?>" id="accordion<?= self::$accordions ?>" <?= self::parseAttributes($attributes, array('class', 'id', 'close')) ?>>
            <?php
            foreach ($groups as $key => $group) {
                if (empty($group['heading']) || empty($group['body'])) {
                    throw new Exception('Each accordion group must have a heading and a body');
                }
                ?>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" data-toggle="collapse"
                           data-parent="#accordion<?= self::$accordions ?>"
                           href="#group-<?= self::$accordions . $key ?>">
                               <?= $group['heading'] ?>
                        </a>
                    </div>
                    <div class="accordion-body collapse in" id="group-<?= self::$accordions . $key ?>">
                        <div class="accordion-inner">
                            <?= $group['body'] ?>
                        </div>
                    </div>
                </div>
                <?php
                $collapse++;
            }
            ?>
        </div>
        <script>
            $(document).ready(function () {
                $('#accordion<?= self::$accordions ?>').collapse();
            })
        </script>
        <?php
        return ob_get_clean();
    }
public static function accordion ( array $ groups , array $ attributes = array ( ) ) { self :: $ accordions ++ ; $ collapse = 1 ; ob_start ( ) ; ?>
        <div data-close="<?= @ $ attributes [ 'close' ] ?>" class="accordion <?= @ $ attributes [ 'class' ] ?>" id="accordion<?= self :: $ accordions ?>" <?= self :: parseAttributes ( $ attributes , array ( 'class' , 'id' , 'close' ) ) ?>>
            <?php foreach ( $ groups as $ key => $ group ) { if ( empty ( $ group [ 'heading' ] ) || empty ( $ group [ 'body' ] ) ) { throw new Exception ( 'Each accordion group must have a heading and a body' ) ; } ?>
                <div class="accordion-group">
                    <div class="accordion-heading">
                        <a class="accordion-toggle" data-toggle="collapse"
                           data-parent="#accordion<?= self :: $ accordions ?>"
                           href="#group-<?= self :: $ accordions . $ key ?>">
                               <?= $ group [ 'heading' ] ?>
                        </a>
                    </div>
                    <div class="accordion-body collapse in" id="group-<?= self :: $ accordions . $ key ?>">
                        <div class="accordion-inner">
                            <?= $ group [ 'body' ] ?>
                        </div>
                    </div>
                </div>
                <?php $ collapse ++ ; } ?>
        </div>
        <script>
            $(document).ready(function () {
                $('#accordion<?= self :: $ accordions ?>').collapse();
            })
        </script>
        <?php return ob_get_clean ( ) ; }
Creates an accordion
@todo Allow closing on attribute close. Currently, TWB closes it but no
longer allows opening. So, this is to be implemented in the future
@param array $groups Array of groups to add to the carousel
Example:
Array (
array(
'heading' => 'Group Heading',
'body' => 'Group content to be shown|hidden',
)
)
@param array $attributes Array of attributes for the accordion. An optional
attribute is 'close' which takes a boolean indicating whether the accordion
should be collapsed(true) or not (false)
@return string
Creates an accordion