Skip to content

Fix fatal error in view when using block template

Choose a tag to compare

@embold-tyler embold-tyler released this 24 Jul 15:49
· 7 commits to master since this release
62498e9

Change plugin homepage to the GitHub repo
Fix fatal error in view by converting template array to JSON string

The Why?

When creating blocks through the cli before, by default it would error when rendering the view because $block->template was returning an array instead of a json encoded string as expected.

<InnerBlocks template="{{ $block->template }}">

A workaround was to encode the string from the view:

<InnerBlocks template="@json_encode( $block->template )">

Now, template will be converted in the render function, before it gets passed to the view, so the generated block will just work out of the box.