HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/insiders/wp-load/wp-content/plugins/gutenmate/block-supports/block-style.php
<?php
defined( 'GTM_GLOBAL_BLOCK_STYLE' ) || define( 'GTM_GLOBAL_BLOCK_STYLE', 'global' );

include __DIR__ . '/class-block-style.php';
$block_style = GTM_Block_Style::get_instance();
$block_style->init();

function gtm_do_compile_block_style( $block_type, $block_attributes ) {
	$global_filter_name = 'gtm.BlockStyleCompiler.' . GTM_GLOBAL_BLOCK_STYLE;
	$filter_name        = 'gtm.BlockStyleCompiler.' . $block_type->name;

	$inlineStyle = ['classes' => [], 'style' => []];
	$inlineStyle = apply_filters( $global_filter_name, $inlineStyle, $block_attributes, $block_type->name );
	$inlineStyle = apply_filters( $filter_name, $inlineStyle, $block_attributes, $block_type->name );

	if ( empty( $inlineStyle['classes'] ) && empty( $inlineStyle['style'] ) ) {
		return false;
	} else {
		return $inlineStyle;
	}
}

/*
Apply default value to block attribute,
to keep the same css rendering as on editor
 */
function gtm_apply_block_attribute_defaults( $block_attributes, $block_type_attributes ) {
	if ( ! empty( $block_type_attributes ) ) {
		foreach ( $block_type_attributes as $key => $def_attr ) {
			if ( ! isset( $block_attributes[$key] ) && isset( $def_attr['default'] ) ) {
				$block_attributes[$key] = $def_attr['default'];
			}
		}
	}

	return $block_attributes;
}