You are here

function bs_shortcodes_tab in Bootstrap 3 shortcodes 7

bs_shortcodes_tab

@author Filip Stefansson @since 1.0

File

./bs_shortcodes.module, line 1215

Code

function bs_shortcodes_tab($attrs, $content = '') {
  if (!isset($GLOBALS['tabs_count'])) {
    $GLOBALS['tabs_count'] = 0;
  }
  extract(shortcode_attrs(array(
    'title' => '',
    'active' => '',
    'fade' => '',
    'xclass' => '',
    'data' => '',
  ), $attrs));
  $class = 'tab-pane';
  $class .= $fade != '' ? ' fade' : '';
  $class .= $active != '' ? ' active' : '';
  $class .= $active != '' && $fade != '' ? ' in' : '';
  $id = drupal_html_class('custom-tab-' . $GLOBALS['tabs_count'] . '-' . check_plain($title));
  $data_props = _bs_shortcodes_parse_data_attributes($data);

  // We need to pass the title attribute to the tabs shortcode here ~Jur
  return sprintf('<div id="%s" title="%s" class="%s"%s>%s</div>', check_plain($id), check_plain($title), check_plain($class), $data_props ? ' ' . $data_props : '', $content);
}