You are here

function bs_shortcodes_modal in Bootstrap 3 shortcodes 7

bs_shortcodes_modal

@author M. W. Delaney @since 1.0

File

./bs_shortcodes.module, line 1855

Code

function bs_shortcodes_modal($attrs, $content = '') {
  extract(shortcode_attrs(array(
    "text" => '',
    "title" => '',
    "size" => '',
    "xclass" => '',
    "data" => '',
  ), $attrs));
  $a_class = '';
  $a_class .= $xclass ? ' ' . $xclass : '';
  $div_class = 'modal fade';
  $div_class .= $size ? ' bs-modal-' . $size : '';
  $id = 'custom-modal-' . check_plain($title);
  $data_props = _bs_shortcodes_parse_data_attributes($data);
  return sprintf('<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>
      <div class="%5$s" id="%1$s" tabindex="-1" role="dialog" aria-hidden="TRUE">
          <div class="modal-dialog">
              <div class="modal-content">
                  <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-hidden="TRUE">&times;</button>
                      %6$s
                  </div>
                  <div class="modal-body">
                      %7$s
                  </div>
              </div> <!-- /.modal-content -->
          </div> <!-- /.modal-dialog -->
      </div> <!-- /.modal -->
    ', drupal_html_id($id), check_plain($a_class), $data_props ? ' ' . $data_props : '', check_markup($text), check_plain($div_class), $title ? '<h4 class="modal-title">' . $title . '</h4>' : '', $content);
}