Skip to content

Commit

Permalink
Use the right functions to validate variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Lalo Sanchez authored and oakesjosh committed Feb 21, 2024
1 parent 639fc6c commit 903ef28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions includes/blocks/class-kadence-blocks-icon-list-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) {

$list_gap_props = array(
'listGap' => array(
0 => ! empty( $attributes['listGap'] ) ? $attributes['listGap'] : '5',
1 => ! empty( $attributes['tabletListGap'] ) ? $attributes['tabletListGap'] : ( ! empty( $attributes['listGap'] ) ? $attributes['listGap'] : '' ),
2 => ! empty( $attributes['mobileListGap'] ) ? $attributes['mobileListGap'] : ( ! empty( $attributes['tabletListGap'] ) ? $attributes['tabletListGap'] : ( ! empty( $attributes['listGap'] ) ? $attributes['listGap'] : '' ) ),
),
0 => isset( $attributes['listGap'] ) ? $attributes['listGap'] : '5',
1 => isset( $attributes['tabletListGap'] ) ? $attributes['tabletListGap'] : '',
2 => isset( $attributes['mobileListGap'] ) ? $attributes['mobileListGap'] : '',
)
);

$css->set_selector( '.wp-block-kadence-iconlist.kt-svg-icon-list-items' . $unique_id . ' ul.kt-svg-icon-list' );
Expand Down
6 changes: 3 additions & 3 deletions includes/class-kadence-blocks-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -1707,14 +1707,14 @@ public function render_responsive_range( $attributes, $name = 'width', $property
}
$unit = ! empty( $attributes[ $unit ] ) ? $attributes[ $unit ] : 'px';
if ( isset( $attributes[ $name ] ) && is_array( $attributes[ $name ] ) ) {
if ( ! empty( $attributes[ $name ][0] ) ) {
if ( isset( $attributes[ $name ][0] ) && is_numeric( $attributes[ $name ][0] ) ) {
$this->add_property( $property, $attributes[ $name ][0] . $unit );
}
if ( ! empty( $attributes[ $name ][1] ) ) {
if ( isset( $attributes[ $name ][1] ) && is_numeric( $attributes[ $name ][1] ) ){
$this->set_media_state( 'tablet' );
$this->add_property( $property, $attributes[ $name ][1] . $unit );
}
if ( ! empty( $attributes[ $name ][2] ) ) {
if ( isset( $attributes[ $name ][2] ) && is_numeric( $attributes[ $name ][2] ) ) {
$this->set_media_state( 'mobile' );
$this->add_property( $property, $attributes[ $name ][2] . $unit );
}
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/iconlist/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ function KadenceIconLists( props ) {
label={__( 'List Vertical Spacing' )}
value={listGap}
onChange={value => setAttributes( { listGap: value } )}
tabletValue={( tabletListGap ? tabletListGap : '' )}
tabletValue={( undefined !== tabletListGap ? tabletListGap : '' )}
onChangeTablet={( value ) => setAttributes( { tabletListGap: value } )}
mobileValue={( mobileListGap ? mobileListGap : '' )}
mobileValue={( undefined !== mobileListGap ? mobileListGap : '' )}
onChangeMobile={( value ) => setAttributes( { mobileListGap: value } )}
min={0}
max={60}
Expand Down

0 comments on commit 903ef28

Please sign in to comment.