You are here

function bs_shortcodes_progress_bar in Bootstrap 3 shortcodes 7

bs_shortcodes_progress_bar

File

./bs_shortcodes.module, line 543

Code

function bs_shortcodes_progress_bar($attrs, $content = '') {
  extract(shortcode_attrs(array(
    "type" => '',
    "percent" => '',
    "label" => '',
    "xclass" => '',
    "data" => '',
  ), $attrs));
  $class = 'progress-bar';
  $class .= $type ? ' progress-bar-' . $type : '';
  $class .= $xclass ? ' ' . $xclass : '';
  $data_props = _bs_shortcodes_parse_data_attributes($data);
  return sprintf('<div class="%s" role="progressbar" %s%s>%s</div>', check_plain($class), $percent ? ' aria-value="' . (int) $percent . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $percent . '%;"' : '', $data_props ? ' ' . $data_props : '', $percent ? sprintf('<span%s>%s</span>', !$label ? ' class="sr-only"' : '', (int) $percent . '% Complete') : '');
}