Added nested blocks support (inner_blocks). ACF Only.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user