Skip to content

Commit

Permalink
Pass sizing attribute to determine if responsiveness should be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarssanchez committed Jan 17, 2022
1 parent 4a243c6 commit 542df19
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions includes/class-bc-playlist-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public static function bc_playlist( $atts ) {
'autoplay' => '',
'mute' => '',
'embed' => '',
'sizing' => 'responsive',
'padding_top' => '56.25%',
'min_width' => '0px',
'max_width' => '100%',
Expand Down
8 changes: 5 additions & 3 deletions includes/class-bc-utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ public static function get_video_player( $atts ) {
$id = self::sanitize_id( $atts['video_id'] );
$height = sanitize_text_field( $atts['height'] );
$width = sanitize_text_field( $atts['width'] );
$sizing = sanitize_text_field( $atts['sizing'] );
$min_width = sanitize_text_field( $atts['min_width'] );
$max_width = sanitize_text_field( $atts['max_width'] );
$padding_top = sanitize_text_field( $atts['padding_top'] );
Expand Down Expand Up @@ -863,7 +864,7 @@ class="vjs-fluid"
data-usage="<?php echo esc_attr( self::get_usage_data() ); ?>javascript"
data-embed="default" class="video-js"
controls <?php echo esc_attr( $playsinline ); ?> <?php echo esc_attr( $autoplay ); ?> <?php echo esc_attr( $mute ); ?>
style="width: <?php echo esc_attr( $width ); ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
style="width: <?php echo 'responsive' !== $sizing ? esc_attr( $width ) : '100%'; ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
</video>

<script src="<?php echo esc_url( $js_src ); ?>"></script>
Expand Down Expand Up @@ -892,7 +893,7 @@ class="vjs-fluid"
allowfullscreen
webkitallowfullscreen
mozallowfullscreen
style="width: <?php echo esc_attr( $width ); ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
style="width: <?php echo 'responsive' !== $sizing ? esc_attr( $width ) : '100%'; ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
</iframe>
</div>
</div>
Expand Down Expand Up @@ -960,6 +961,7 @@ public static function get_playlist_player( $atts ) {
$id = self::sanitize_id( $atts['playlist_id'] );
$height = sanitize_text_field( $atts['height'] );
$width = sanitize_text_field( $atts['width'] );
$sizing = sanitize_text_field( $atts['sizing'] );
$min_width = sanitize_text_field( $atts['min_width'] );
$max_width = sanitize_text_field( $atts['max_width'] );
$padding_top = sanitize_text_field( $atts['padding_top'] );
Expand Down Expand Up @@ -1116,7 +1118,7 @@ class="video-js"
allowfullscreen
webkitallowfullscreen
mozallowfullscreen
style="width: <?php echo esc_attr( $width ); ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
style="width: <?php echo 'responsive' !== $sizing ? esc_attr( $width ) : '100%'; ?>; height: <?php echo esc_attr( $height ); ?>; position: absolute; top: 0; bottom: 0; right: 0; left: 0;">
</iframe>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions includes/class-bc-video-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static function bc_video( $atts ) {
'autoplay' => '',
'mute' => '',
'embed' => '',
'sizing' => 'responsive',
'padding_top' => '56.25%',
'min_width' => '0px',
'max_width' => '100%',
Expand Down

0 comments on commit 542df19

Please sign in to comment.