lazy-blocks
lazy-blocks copied to clipboard
Additional wrapper checkbox
trafficstars
Could you make additional block markup wrapper voluntary, perhaps add a setting to "additional settings" section?
Talking about this, $allow_wrapper = apply_filters( $block['slug'] . '/' . $context . '_allow_wrapper', $result && 'frontend' === $context, $attributes );.
I'd like to see this too. In the meantime, I've doing this but it's not very tidy:
// Stript the outer div from a block as it's breaking Bootstrap grid
function wporg_strip_outer_div( $block_content, $block ) {
if (substr($block['blockName'], 0, 10) == 'lazyblock/') {
return preg_replace( '/^<[^>]+>|<\/[^>]+>$/', '', $block_content );
} else {
return $block_content;
}
}
add_filter( 'render_block', 'wporg_strip_outer_div', 10, 2 );
@martynbiz why are you doing this? We have PHP filters - https://lazyblocks.com/documentation/php-filters/lzb-block_render-allow_wrapper/