Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Add support for responsive tables in [table-wrap]
Browse files Browse the repository at this point in the history
  • Loading branch information
MWDelaney committed Nov 28, 2014
1 parent fb27031 commit 50033ef
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions bootstrap-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,14 @@ function bs_column( $atts, $content = null ) {
$class .= ( $atts['offset_md'] || $atts['offset_md'] === "0" ) ? ' col-md-offset-' . $atts['offset_md'] : '';
$class .= ( $atts['offset_sm'] || $atts['offset_sm'] === "0" ) ? ' col-sm-offset-' . $atts['offset_sm'] : '';
$class .= ( $atts['offset_xs'] || $atts['offset_xs'] === "0" ) ? ' col-xs-offset-' . $atts['offset_xs'] : '';
$class .= ( $atts['pull_lg'] || $atts['pull_lg'] === "0" ) ? ' col-lg-pull-' . $atts['pull_lg'] : '';
$class .= ( $atts['pull_md'] || $atts['pull_md'] === "0" ) ? ' col-md-pull-' . $atts['pull_md'] : '';
$class .= ( $atts['pull_sm'] || $atts['pull_sm'] === "0" ) ? ' col-sm-pull-' . $atts['pull_sm'] : '';
$class .= ( $atts['pull_xs'] || $atts['pull_xs'] === "0" ) ? ' col-xs-pull-' . $atts['pull_xs'] : '';
$class .= ( $atts['push_lg'] || $atts['push_lg'] === "0" ) ? ' col-lg-push-' . $atts['push_lg'] : '';
$class .= ( $atts['push_md'] || $atts['push_md'] === "0" ) ? ' col-md-push-' . $atts['push_md'] : '';
$class .= ( $atts['push_sm'] || $atts['push_sm'] === "0" ) ? ' col-sm-push-' . $atts['push_sm'] : '';
$class .= ( $atts['push_xs'] || $atts['push_xs'] === "0" ) ? ' col-xs-push-' . $atts['push_xs'] : '';
$class .= ( $atts['pull_lg'] || $atts['pull_lg'] === "0" ) ? ' col-lg-pull-' . $atts['pull_lg'] : '';
$class .= ( $atts['pull_md'] || $atts['pull_md'] === "0" ) ? ' col-md-pull-' . $atts['pull_md'] : '';
$class .= ( $atts['pull_sm'] || $atts['pull_sm'] === "0" ) ? ' col-sm-pull-' . $atts['pull_sm'] : '';
$class .= ( $atts['pull_xs'] || $atts['pull_xs'] === "0" ) ? ' col-xs-pull-' . $atts['pull_xs'] : '';
$class .= ( $atts['push_lg'] || $atts['push_lg'] === "0" ) ? ' col-lg-push-' . $atts['push_lg'] : '';
$class .= ( $atts['push_md'] || $atts['push_md'] === "0" ) ? ' col-md-push-' . $atts['push_md'] : '';
$class .= ( $atts['push_sm'] || $atts['push_sm'] === "0" ) ? ' col-sm-push-' . $atts['push_sm'] : '';
$class .= ( $atts['push_xs'] || $atts['push_xs'] === "0" ) ? ' col-xs-push-' . $atts['push_xs'] : '';
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';

$data_props = $this->parse_data_attributes( $atts['data'] );
Expand Down Expand Up @@ -1014,27 +1014,29 @@ function bs_table( $atts ) {
function bs_table_wrap( $atts, $content = null ) {

$atts = shortcode_atts( array(
'bordered' => false,
'striped' => false,
'hover' => false,
'condensed' => false,
'xclass' => false,
'data' => false
'bordered' => false,
'striped' => false,
'hover' => false,
'condensed' => false,
'responsive' => false,
'xclass' => false,
'data' => false
), $atts );

$class = 'table';
$class .= ( $atts['bordered'] == 'true' ) ? ' table-bordered' : '';
$class .= ( $atts['striped'] == 'true' ) ? ' table-striped' : '';
$class .= ( $atts['hover'] == 'true' ) ? ' table-hover' : '';
$class .= ( $atts['bordered'] == 'true' ) ? ' table-bordered' : '';
$class .= ( $atts['striped'] == 'true' ) ? ' table-striped' : '';
$class .= ( $atts['hover'] == 'true' ) ? ' table-hover' : '';
$class .= ( $atts['condensed'] == 'true' ) ? ' table-condensed' : '';
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';

$return = '';

$tag = array('table');
$content = do_shortcode($content);

$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
$return = ( $atts['responsive'] ) ? '<div class="table-responsive">' . $return . '</div>' : $return;
return $return;
}

Expand Down

0 comments on commit 50033ef

Please sign in to comment.