Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with gutenberg #14

Open
bc-ian opened this issue Apr 23, 2021 · 0 comments
Open

Using with gutenberg #14

bc-ian opened this issue Apr 23, 2021 · 0 comments

Comments

@bc-ian
Copy link

bc-ian commented Apr 23, 2021

Any idea how to get Blade to compile the data that gets rendered through a gutenberg block?

I have the blocks all registered and the data flowing but if I write in blade instead of php it just outputs the plain text, it doesn't compile the blade code.

Here is my block:

/**
 * ACF Blocks
 */
add_action('acf/init', 'my_acf_init_block_types');
function my_acf_init_block_types() {

    // Check function exists.
    if( function_exists('acf_register_block_type') ) {

        // register a testimonial block.
        acf_register_block_type(array(
            'name'              => 'image-hero',
            'title'             => __('Image Hero Block'),
            'description'       => __('A large image with square text box.'),
            'render_template'   => 'templates/partials/blocks/image-hero.blade.php',
            'category'          => 'custom',
            'icon'              => 'admin-comments',
            'keywords'          => array( 'image', 'hero' ),
        ));
    }
}

From what I can tell I think adding something to the render template might do the trick but not sure exactly what.

Not sure if this thread helps at all: I am registering blocks the same way as this guy was in this thread: https://discourse.roots.io/t/gutenberg-block-render-template-and-blade/20194

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant