File: /var/www/html/insiders/wp-load/wp-content/plugins/breadly/block-supports/line-clamp.php
<?php
// No need to register any attributes, just use block style's compiler
add_filter( 'register_block_type_args', 'gtm_register_line_clamp_support', 10, 2 );
function gtm_register_line_clamp_support( $args, $name ) {
add_filter( "gtm.BlockStyleCompiler.{$name}", 'gtm_compile_css_line_clamp', 10, 3 );
return $args;
}
function gtm_compile_css_line_clamp( $output, $attributes, $blockName ) {
$block_style = ['classes' => [], 'style' => []];
if ( isset( $attributes['gtmLineClamp'] ) ) {
gtm_css_compileCssVar( $block_style,
'line-clamp',
$attributes['gtmLineClamp']
);
}
////////////////////
// Check rendered style to avoid unnecessary operation
// Because this feature is applied on all blocks
if ( ! empty( $block_style['style'] ) || ! empty( $block_style['style'] ) ) {
// 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'] ),
];
} else {
// No changes
return $output;
}
}