[ $this, 'render_css' ], ] ); } /** * Builds CSS for block. * * @param array $attributes the blocks attributes. * @param Kadence_Blocks_CSS $css the css class for blocks. * @param string $unique_id the blocks attr ID. * @param string $unique_style_id the blocks alternate ID for queries. */ public function build_css( $attributes, $css, $unique_id, $unique_style_id ) { $css->set_style_id( 'kb-' . $this->block_name . $unique_style_id ); $css->set_selector( '.wp-block-kadence-header-column' . $unique_id ); return $css->css_output(); } /** * The innerblocks are stored on the $content variable. We just wrap with our data, if needed * * @param array $attributes The block attributes. * * @return string Returns the block output. */ public function build_html( $attributes, $unique_id, $content, $block_instance ) { if( !empty( $block_instance->context['kadence/headerRowLayoutConfig'] ) && $block_instance->context['kadence/headerRowLayoutConfig'] === 'single' && !empty( $attributes['location'] ) && $attributes['location'] !== 'left' && $attributes['location'] !== 'tablet-left' ) { $content = ''; } if ( ! empty( $attributes['location'] ) && ! in_array( $attributes['location'], ['tablet-center', 'tablet-left', 'tablet-right', 'center-left', 'center', 'center-right' ] ) ) { return $content; } $classes = [ 'wp-block-kadence-header-column' ]; if ( ! empty( $attributes['location'] ) ) { $classes[] = 'wp-block-kadence-header-column-' . esc_attr( $attributes['location'] ); //append a fake column in tablet left and right for more consistent styling compared to desktop if ( $attributes['location'] == 'tablet-left' ) { $content .= '
'; } if ( $attributes['location'] == 'tablet-right' ) { $content = '' . $content; } } if ( empty( $content ) ) { $classes[] = 'no-content'; if ( ! empty( $attributes['location'] ) && ( 'center' === $attributes['location'] || 'tablet-center' === $attributes['location'] ) ) { $classes[] = 'no-content-column-center'; } } return sprintf( '