You are here

function bs_shortcodes_panel in Bootstrap 3 shortcodes 7

bs_shortcodes_panel

@author M. W. Delaney @since 1.0

File

./bs_shortcodes.module, line 1069

Code

function bs_shortcodes_panel($attrs, $content = '') {
  extract(shortcode_attrs(array(
    "title" => '',
    "heading" => '',
    "type" => '',
    "footer" => '',
    "xclass" => '',
    "data" => '',
  ), $attrs));
  $class = 'panel';
  $class .= $type ? ' panel-' . $type : ' panel-default';
  $class .= $xclass ? ' ' . $xclass : '';
  if (!$heading && $title) {
    $heading = $title;
    $title = TRUE;
  }
  $data_props = _bs_shortcodes_parse_data_attributes($data);
  $footer = $footer ? '<div class="panel-footer">' . $footer . '</div>' : '';
  if ($heading) {
    $heading = sprintf('<div class="panel-heading">%s%s%s</div>', $title ? '<h3 class="panel-title">' : '', check_markup($heading), $title ? '</h3>' : '');
  }
  else {
    $heading = '';
  }
  return sprintf('<div class="%s"%s>%s<div class="panel-body">%s</div>%s</div>', check_plain($class), $data_props ? ' ' . $data_props : '', $heading, $content, $footer ? ' ' . $footer : '');
}