Support

Account

Home Forums Gutenberg ACF 5.8.0-beta2 – Block not in Gutenberg

Solved

ACF 5.8.0-beta2 – Block not in Gutenberg

  • WP 4.9.8
    Gutenberg 4.1.1
    ACF 5.8.0-beta2

    I wrote a small Plugin, so that I do not need to put my blocks in each theme, that we are building for a customer.

    Within this Plugin you are able to activate and deactivate blocks on a Settings Page.
    Only activated Blocks are loaded.

    The Plugin loads the Blocks within a function:

    add_action('acf/init', "include_usblocks");
    function include_usblocks(){
    		global $usblocks;
    		if( function_exists('acf_register_block') ) {
    			$usblocks_active = $usblocks->getActiveBlocks();
    			//echo "<pre>".print_r($usblocks_active,1)."</pre>";
    			foreach($usblocks_active AS $block){
    				require_once dirname(__FILE__)."/blocks/$block/block.php";
    			}
    		}else{
    			echo "function 'acf_register_block' not available";
    		}
    	}

    ..and gets the rendering functions

    if( function_exists('acf_register_block') ) {
    		$usblocks_active = $usblocks->getActiveBlocks();
    		//echo "<pre>".print_r($usblocks_active,1)."</pre>";
    		foreach($usblocks_active AS $block){
    			require_once dirname(__FILE__)."/blocks/$block/block_render.php";
    		}
    	}

    By now there is one block loaded:

    acf_register_block(array(
    		'name'				=> 'featuredarticle',
    		'title'				=> __('Featured Article', "usblocks"),
    		'description'		=> __('Ein Featured-Article Block', "usblocks"),
    		'render_callback'	=> 'block_featuredarticle_html',
    		'category'		=> 'layout',
    		'icon'			=> 'admin-comments',
    		'keywords'		=> array("article", "featured")
    	));

    In ACF I created a Field group for this block and assigned it to be shown in this block.

    When I open a Page to edit, I am not able to find my block.

    Any Ideas?

  • I’m having the same issue @urbanstudio , did you manage to figure out a solution?

  • No solution in sight…

    I tried with the exact code from the example in a theme, but it does not work as well.

  • Me too, the ACF block simply doesn’t seem to show up when trying to insert a new block into the editor.

  • Wow! So I’m not doing something wrong. Same problem here.

    WP 4.9.8
    Gutenberg 4.1.1
    ACF 5.8.0-beta2

    I wish I had visited this page an hour ago…

  • ACF 5.8.0-beta1 still works though…

  • Yup, same here. I’ve created an add-on for a plugin called Toolbox that allow you to create Blocks, add ACF fields to it and the template for rendering the output all from the dashboard. It was working fine ’till I updated.

    Can’t get the most basic example to work with beta2, so rolling back to beta1 until someone can tell me where to start looking.

    EDIT: only rolled back to beta1 and everything is working fine again.

    WP 4.9.8
    Gutenberg 4.1.1

  • Also experienced the same issue. So I rolled back to beta 1 and all is working fine again. Then there was this update notice of beta 2. So I updated again to see what happens and the block indeed disappeared again. Instead I got to see the following message:

    Your site does not support the “acf/testimonial” block. You can leave this block or delete it completely.

    WP 4.9.8
    GB 4.1.1
    ACF 5.8.0. beta2

  • So I tested a little more. I enabled beta 2 again. The boxes (as we know now) do not appear in the editor. If I change the following in acf.php the boxes magically re-appear.

    In the description I changed:
    From: Version: 5.8.0-beta2
    To: Version: 5.8.0-beta1

    In the code
    From
    var $version = '5.8.0-beta2';

    To
    var $version = '5.8.0-beta1';

    However don’t know why this is happening.

  • This is so weird:

    Working:

    ACF 5.8.0-beta1 /WP 5.9.8 / Gutenberg 4.0.0

    NOT working:
    ACF 5.8.0-beta2 / WP 5.9.8 / Gutenberg 4.0.0

    Working:
    5.8.0-beta2 (var $version changed to 5.8.0-beta1) / WP 5.9.8 / Gutenberg 4.0.0

    NOT working:
    5.8.0-beta2 (original) / WP 5.9.8 / Gutenberg 4.1.1

  • Hi all,

    Sorry about this issue, it’s a minor JS mistake.
    Please edit the file “includes/gutenberg/assets/js/acf-blocks.js” on line 90:

    From:
    if( !wp || !wp.blocks || wp.blocks.registerBlockType ) {

    To:
    if( !wp || !wp.blocks || !wp.blocks.registerBlockType ) {

    I have also updated the plugin files online to re-download.

  • The new BETA2 Package is now working! Yeah, Thanks a lot!

  • Thanks Elliot!
    I can confirm this solves the issue.

    It did not work immediately but it did after a hard refresh (shift+F5 or shift+CMD+R).
    Reason it seemed to work with line changed to beta1 also had to do with caching and stopped working after a hard refresh, so forget what I stated in the earlier post 😉

  • I’m using 5.8.0-beta3 & WP 5.0 and experiencing this same issue.

    I tried the fix suggested by @elliot above, but the plugin file structure seems a bit different and I cannot find that line of code.

    I have copied the example (for testimonials) exactly. I am able to select the location of “Testimonial” when I add the field group, but “Testimonial” does not appear in the editor.

    I’m happy to roll back to an earlier beta, but wanted to see if anyone else was having this issue with beta 3 & WP 5.0.

  • @okadots Yes I am having the same issue – I have tried with BETA 2 checking Elliot’s fix above has been implemented, and the problem occurs here too – can register blocks and setup Custom Fields for them – but they are not available in the Gutenburg Editor.

  • @edwardn I figured it out on my end. I had another function that was only enabling certain default blocks. I had it set up as a whitelist instead of a blacklist and so it wasn’t showing my new testimonial test block. Once I disabled my script it appeared in the list!

  • I am having similar issues with BETA 3 and the block not showing up in my page, but I have been able to create the custom fields etc.

    Any help would be greatly appreciated.

  • @dabeecher Were you ever able to resolve the issue with custom blocks not showing up in Gutenberg with ACF 5.8.0-beta3? I just downloaded beta 3 today and none of my custom blocks are appearing as options in Gutenburg.

  • I found my issue, I had a typo in the category argument. I fixed and my custom block now shows up!

  • @kiwicreative glad you managed to sort it.

    My issue was I need to view the block in edit mode otherwise it didn’t show up was just a blank box.

Viewing 21 posts - 1 through 21 (of 21 total)

The topic ‘ACF 5.8.0-beta2 – Block not in Gutenberg’ is closed to new replies.