public function panel()
{
return _class('html')->panel(['title' => 'Panel title', 'body' => 'Panel content']);
}
public function panel($extra = [])
{
if ($this->_is_bs5) {
return $this->_bs5()->panel($extra);
}
$extra['id'] = ($extra['id'] ?? null) ?: __FUNCTION__ . '_' . ($this->_ids[__FUNCTION__] = ($this->_ids[__FUNCTION__] ?? 0) + 1);
$border = $this->_color_type($extra['border'] ?? '', '');
$extra['class'] = ($extra['class'] ?? null) ?: 'panel panel-' . (in_array($border, ['primary', 'success', 'info', 'warning', 'danger'], true) ? $border : 'default');
$subtitle = strlen((string) ($extra['subtitle'] ?? '')) ? ' <small>' . $this->_b4_text($extra['subtitle'], $extra) . '</small>' : '';
$img = strlen((string) ($extra['img_top'] ?? '')) ? '<img' . $this->_b4_attrs(['src' => $this->_safe_href($extra['img_top']), 'class' => 'img-responsive']) . $this->_img_alt($extra) . '>' : '';
$footer = strlen((string) ($extra['footer'] ?? '')) ? '<div class="panel-footer">' . $extra['footer'] . '</div>' : '';
return
'<div class="' . implode(' ', array_filter([($extra['class'] ?? null), ($extra['class_add'] ?? null)])) . '" id="' . ($extra['id'] ?? null) . '">
<div class="panel-heading">
<h3 class="panel-title">' . ($extra['title'] ?? null) . $subtitle . '</h3>
</div>' . $img . '
<div class="panel-body">' . ($extra['body'] ?? null) . '</div>' . $footer . '
</div>';
}