File: /var/www/html/insiders/wp-load/wp-content/plugins/gutenmate/block-library/floating-box.php
<?php
/**
* Registers the `gtm/floating-box` block on the server.
*/
function gtm_register_block_floating_box() {
gtm_register_block_type( 'floating-box' );
}
add_action( 'init', 'gtm_register_block_floating_box', 20 );
add_filter( 'gtm.BlockStyleCompiler.gtm/floating-box', 'gtm_compile_block_css_floating_box', 10, 3 );
function gtm_compile_block_css_floating_box( $output, $attributes, $blockName ) {
$block_style = ['classes' => [], 'style' => []];
$block_style['classes'][] = 'gtm-block';
$block_style['classes'][] = "gtm-has-floating-box-position--" . str_replace( ' ', '-', $attributes['position'] );
$block_style['classes'][] = 'gtm-reveal';
$block_style['classes'][] = "gtm-reveal--{$attributes['revealEffect']}";
$revealCondition = $attributes['revealCondition'] ?: 'scroll-position';
$block_style['classes'][] = "gtm-reveal-condition--{$revealCondition}";
if ( ! empty( $attributes['enableBackdrop'] ) ) {
$block_style['classes'][] = "gtm-has-gtm-floating-box-backdrop";
gtm_css_compileCssVar( $block_style, "floating-box-backdrop-bg", gtm_css_parseColorValue( $attributes['backdropBg'] ) );
}
gtm_css_compileCssVar( $block_style, "floating-box-width", $attributes['width'] );
gtm_css_compileCssVar( $block_style, "floating-box-offset-x", $attributes['offsetX'] );
gtm_css_compileCssVar( $block_style, "floating-box-offset-y", $attributes['offsetY'] );
gtm_css_compileCssVar( $block_style, "floating-box-close-offset-x", $attributes['closeButtonOffsetX'] );
gtm_css_compileCssVar( $block_style, "floating-box-close-offset-y", $attributes['closeButtonOffsetY'] );
gtm_css_compileCssVar( $block_style, "floating-box-close-size", $attributes['closeButtonIconSize'] );
gtm_css_compileCssVar( $block_style, "floating-box-close-width", $attributes['closeButtonWidth'] );
gtm_css_compileCssVar( $block_style, "floating-box-close-radius", gtm_css_parseBorderRadiusValue( $attributes['closeButtonRadius'] ) );
gtm_css_compileCssVar( $block_style, "floating-box-close-color", gtm_css_parseColorValue( $attributes['closeButtonColor'] ) );
gtm_css_compileCssVar( $block_style, "floating-box-close-bg", gtm_css_parseColorValue( $attributes['closeButtonBg'] ) );
// Apply to output
$block_style['style'] = ['{{BLOCK}}' => $block_style['style']];
return [
'classes' => array_merge( $output['classes'], $block_style['classes'] ),
'style' => array_replace_recursive( $output['style'], $block_style['style'] ),
];
}