src/Common.php
public function panel($class, array $sections)
    {
        $html = '';
        foreach ($sections as $panel => $content) {
            if (!is_numeric($panel)) {
                $panel = substr($panel, 0, 4);
            }
            switch ((string) $panel) {
                case 'head':
                    $html .= '<div class="panel-heading">'.$this->addClass($content, array('h([1-6]){1}' => 'panel-title')).'</div>';
                    break;
                case 'body':
                    $html .= '<div class="panel-body">'.$content.'</div>';
                    break;
                case 'foot':
                    $html .= '<div class="panel-footer">'.$content.'</div>';
                    break;
                default:
                    $html .= $content;
                    break; // a table, or list group, or ...
            }
        }

        return $this->page->tag('div', array(
            'class' => $this->prefixClasses('panel', array('default', 'primary', 'success', 'info', 'warning', 'danger'), $class),
        ), $html);
    }
public function panel($class, array $sections)
    {
        $html = '';
        foreach ($sections as $panel => $content) {
            if (!is_numeric($panel)) {
                $panel = substr($panel, 0, 4);
            }
            switch ((string) $panel) {
                case 'head':
                    $html .= '<div class="panel-heading">'.$this->addClass($content, array('h([1-6]){1}' => 'panel-title')).'</div>';
                    break;
                case 'body':
                    $html .= '<div class="panel-body">'.$content.'</div>';
                    break;
                case 'foot':
                    $html .= '<div class="panel-footer">'.$content.'</div>';
                    break;
                default:
                    $html .= $content;
                    break; // a table, or list group, or ...
            }
        }

        return $this->page->tag('div', array(
            'class' => $this->prefixClasses('panel', array('default', 'primary', 'success', 'info', 'warning', 'danger'), $class),
        ), $html);
    }
public function panel ( $ class , array $ sections ) { $ html = '' ; foreach ( $ sections as $ panel => $ content ) { if ( ! is_numeric ( $ panel ) ) { $ panel = substr ( $ panel , 0 , 4 ) ; } switch ( ( string ) $ panel ) { case 'head' : $ html .= '<div class="panel-heading">' . $ this -> addClass ( $ content , array ( 'h([1-6]){1}' => 'panel-title' ) ) . '</div>' ; break ; case 'body' : $ html .= '<div class="panel-body">' . $ content . '</div>' ; break ; case 'foot' : $ html .= '<div class="panel-footer">' . $ content . '</div>' ; break ; default : $ html .= $ content ; break ; // a table, or list group, or ... } } return $ this -> page -> tag ( 'div' , array ( 'class' => $ this -> prefixClasses ( 'panel' , array ( 'default' , 'primary' , 'success' , 'info' , 'warning' , 'danger' ) , $ class ) , ) , $ html ) ; }
Creates a Bootstrap panel component.

@param string $class    Either '**default**', '**primary**', '**success**', '**info**', '**warning**', or '**danger**'. The '**panel**' class and prefix are automatically included. You can add more classes to it if you like.
@param array  $sections An ``array($panel => $content, ...)`` of sections. If **$panel** equals:

- '**head**', '**header**', or '**heading**' => The panel heading **$content**. All ``<h1-6>`` headers will be classed appropriately.
- '**body**' => The panel body **$content**.
- '**foot**', '**footer**', or '**footing**' => The panel footer **$content**.
- Anything else will just be inserted as is. It could be a table, or list group, or ...

@return string

@example

```php
echo $bp->panel('primary', array(
'header' => '<h3>Title</h3>',
'body' => 'Content',
'footer' => '<a href="#">Link</a>',
));

echo $bp->panel('default', array(
'header': 'List group',
$bp->listGroup(array(
'One',
'Two',
'Three',
)),
));
```
Creates a Bootstrap panel component .