You are here

function _bs_shortcodes_parse_data_attributes in Bootstrap 3 shortcodes 7

Same name and namespace in other branches
  1. 8 bs_shortcodes.module \_bs_shortcodes_parse_data_attributes()

Parse data-attributes for shortcodes

44 calls to _bs_shortcodes_parse_data_attributes()
bs_shortcodes_alert in ./bs_shortcodes.module
bs_shortcodes_alert
bs_shortcodes_badge in ./bs_shortcodes.module
bs_shortcodes_badge
bs_shortcodes_breadcrumb in ./bs_shortcodes.module
bs_shortcodes_breadcrumb
bs_shortcodes_breadcrumb_item in ./bs_shortcodes.module
bs_shortcodes_breadcrumb_item
bs_shortcodes_button in ./bs_shortcodes.module
bs_shortcodes_button

... See full list

File

./bs_shortcodes.module, line 1971

Code

function _bs_shortcodes_parse_data_attributes($data) {
  $data_props = '';
  if ($data) {
    $data = explode('|', $data);
    foreach ($data as $d) {
      $d = explode(',', $d);
      $data_props .= sprintf('data-%s="%s" ', check_plain($d[0]), check_plain(trim($d[1])));
    }
  }
  else {
    $data_props = FALSE;
  }
  return $data_props;
}