You are here

function _bs_shortcodes_parse_data_attributes in Bootstrap 3 shortcodes 8

Same name and namespace in other branches
  1. 7 bs_shortcodes.module \_bs_shortcodes_parse_data_attributes()
33 calls to _bs_shortcodes_parse_data_attributes()
BootstrapAlertShortcode::process in src/Plugin/Shortcode/BootstrapAlertShortcode.php
Performs the shortcode processing.
BootstrapBadgeShortcode::process in src/Plugin/Shortcode/BootstrapBadgeShortcode.php
Performs the shortcode processing.
BootstrapBreadcrumbItemShortcode::process in src/Plugin/Shortcode/BootstrapBreadcrumbItemShortcode.php
Performs the shortcode processing.
BootstrapBreadcrumbShortcode::process in src/Plugin/Shortcode/BootstrapBreadcrumbShortcode.php
Performs the shortcode processing.
BootstrapButtonGroupShortcode::process in src/Plugin/Shortcode/BootstrapButtonGroupShortcode.php
Performs the shortcode processing.

... See full list

File

./bs_shortcodes.module, line 11

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" ', Html::escape($d[0]), Html::escape(trim($d[1])));
    }
  }
  else {
    $data_props = FALSE;
  }
  return $data_props;
}