Sage ACF Gutenberg blocks - How can we add a preview?

We implemented this great package by MWDelaney.

We have setup some custom blocks with this setup, but the preview in CMS says “No preview available”. Anybody knows how we can add preview content for custom block within the setup we use?

To render a block preview, you must set a minimum of example: {} when calling registerBlockType. The prop can pass in defaults to your block in order to render a preview.

That package looks abandoned to me. But anyway, if you’re using the latest 0.7 release, it doesn’t seem to support previews, as the last commit to master adds preview support. Either use the package direct from master (:face_vomiting:), or switch to log1x/acf-composer (which works really well).

3 Likes

Hi! I admit to not keeping this package as up-to-date as I could. Generally speaking it does still work, but you’ll probably want to fork and customize it to add newer ACF features it doesn’t support.

Or, as @talss89 suggested, log1x/acf-composer is a great, more well maintained package!

2 Likes

Already noticed the last edit, but tried it and was still working like a charm!

Played around with the ACF composer just now, seems to work very nice indeed. My team is used to building field groups within the CMS. It looks like this should be done now in code fully when using this package, you know by any chance if that is mandatory or recommended? Think there are some advantaged with adding fields in code, but will take a bit more time per section.