You are here

function bs_shortcodes_alert in Bootstrap 3 shortcodes 7

bs_shortcodes_alert

@author Filip Stefansson @since 1.0

File

./bs_shortcodes.module, line 482

Code

function bs_shortcodes_alert($attrs, $content = '') {
  extract(shortcode_attrs(array(
    "type" => '',
    "dismissable" => '',
    "xclass" => '',
    "data" => '',
  ), $attrs));
  $class = 'alert';
  $class .= $type ? ' alert-' . $type : ' alert-success';
  $class .= $dismissable != '' ? ' alert-dismissable' : '';
  $class .= $xclass ? ' ' . $xclass : '';
  $dismissable = $dismissable ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="TRUE">&times;</button>' : '';
  $data_props = _bs_shortcodes_parse_data_attributes($data);
  return sprintf('<div class="%s"%s>%s%s</div>', check_plain($class), $data_props ? ' ' . $data_props : '', $dismissable, $content);
}