diff --git a/includes/blocks/class-kadence-blocks-row-layout-block.php b/includes/blocks/class-kadence-blocks-row-layout-block.php index dd3797a7c..c6719de09 100644 --- a/includes/blocks/class-kadence-blocks-row-layout-block.php +++ b/includes/blocks/class-kadence-blocks-row-layout-block.php @@ -566,15 +566,7 @@ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) { } $css->set_media_state( 'desktop' ); } - // Update $attributes if there are custom gaps that need to be inherited. - if ( ! empty( $attributes['columnGutter'] ) ) { - if ( empty( $attributes['tabletGutter'] ) ) { - $attributes['tabletGutter'] = $attributes['columnGutter']; - } - if ( empty( $attributes['mobileGutter'] ) ) { - $attributes['mobileGutter'] = $attributes['tabletGutter']; - } - } + //Tablet layout if ( empty( $attributes['tabletLayout'] ) && ! empty( $css->render_row_gap_property( $attributes, array( 'columnGutter', 'tabletGutter', 'mobileGutter' ), 'tablet', 'customGutter', 'gutterType' ) ) ) { //no tablet layout, but we have a tablet guttter width, so render the inherited column layout from desktop, potentially with custom widths. diff --git a/includes/class-kadence-blocks-css.php b/includes/class-kadence-blocks-css.php index ed602939c..24fefb91b 100644 --- a/includes/class-kadence-blocks-css.php +++ b/includes/class-kadence-blocks-css.php @@ -1372,10 +1372,9 @@ public function render_row_gap( $attributes, $name = array( 'gap', 'tabletGap', $this->set_media_state( 'desktop' ); } /** - * Generates the shadow output. + * Generates the gutter gap output. * - * @param array $shadow an array of shadow settings. - * @return string + */ public function render_row_gap_property( $attributes, $name = array( 'gap', 'tabletGap', 'mobileGap' ), $device = 'desktop', $custom = '', $unit_name = 'gapUnit' ) { if ( empty( $attributes ) || empty( $name ) ) { @@ -1385,6 +1384,21 @@ public function render_row_gap_property( $attributes, $name = array( 'gap', 'tab return ''; } $unit = ! empty( $attributes[ $unit_name ] ) ? $attributes[ $unit_name ] : 'px'; + // inherit tablet and mobile values + if ( is_array( $name ) && ! empty( $attributes[ $name[0] ] ) ) { + if ( empty( $attributes[ $name[1] ] ) ) { + $attributes[ $name[1] ] = $attributes[ $name[0] ]; + } + if ( empty( $attributes[ $name[2] ] ) ) { + $attributes[ $name[2] ] = $attributes[ $name[1] ]; + } + if ( $attributes[ $name[1] ] === 'custom' && empty( $attributes[ $custom ][1] ) ) { + $attributes[ $custom ][1] = $attributes[ $custom ][0]; + } + if ( $attributes[ $name[2] ] === 'custom' && empty( $attributes[ $custom ][2] ) ) { + $attributes[ $custom ][2] = $attributes[ $custom ][1]; + } + } switch ( $device ) { case 'tablet': if ( ! empty( $attributes[ $name[1] ] ) ) {