Added nested blocks support (inner_blocks). ACF Only.

This commit is contained in:
2025-05-12 17:28:39 -06:00
parent 95e0cae3ed
commit a22a179eff
4 changed files with 12 additions and 11 deletions
+2 -8
View File
@@ -35,14 +35,6 @@ trait Custom_Handlebars {
return $context;
} );
$this->add_handlebar( 'safe_html', function ( $context ) {
if ( function_exists( 'wp_kses_post' ) ) {
return wp_kses_post( $context );
}
return $context;
} );
}
public function add_handlebar( $key, $func ): void {
@@ -91,6 +83,8 @@ class Component_Builder {
private function get_handlebars_template( $path = '' ): string {
$template = file_get_contents( $path );
$template = preg_replace( '/{{inner_blocks}}/', '<InnerBlocks/>', $template );
$phpStr = LightnCandy::compile( $template,
[
'flags' => Flags::FLAG_NOESCAPE | Flags::FLAG_PARENT | Flags::FLAG_SPVARS | Flags::FLAG_ELSE | Flags::FLAG_JSLENGTH | Flags::FLAG_JSTRUE | Flags::FLAG_THIS,