Support

Account

Home Forums Gutenberg ACF 6 + Timber renderCallback not working in editor

Solved

ACF 6 + Timber renderCallback not working in editor

  • I’m having a similar issue to this ticket. I’m using ACF and Timber with a renderCallback function. This works fine and seems to load the template on the front end but doesn’t seem to work in the editor. I get ‘Your site doesn’t include support for the “acf/[blockname]” block. You can leave this block intact or remove it entirely.’ errors in the editor even though the blocks load on the front-end. It even pulls in the field data that existed before I switched to block.json on the front-end only.

    /button/block.json

    {
      "name": "acf/button",
      "title": "Button",
      "description": "A button block.",
      "category": "dream",
      "icon": "button",
      "keywords": ["button", "buttons", "button group"],
      "attributes": {
        "blockId": {
          "type": "string"
        }
      },
      "usesContext": [ "buttonGroup/blockId" ],
      "supports": {
        "jsx": true,
        "align": true,
        "alignContent": true,
        "alignText": true,
        "anchor": true,
        "className": true,
        "multiple": true,
        "html": false,
        "inserter": true,
        "color": {
          "text": false,
          "background": true,
          "link": false,
          "gradients": true,
          "linkColor": true
        },
        "fontSize": true,
        "fullHeight": false
      },
      "styles": [
        { "name": "default", "label": "Default", "isDefault": true },
        { "name": "other", "label": "Other" }
      ],
      "editorScript": "file:./index.js",
      "script": "file:./script.js",
      "editorStyle": "file:./index.css",
      "style": "file:./style.css",
      "acf": {
        "mode": "preview",
        "renderCallback": "dream_block_render",
        "postTypes": true,
        "parent": "acf/button-group",
        "reusable": true
      }
    }

    I also get a js error in the console when editing pages whether or not blocks exist on the page:

    acf-pro-blocks.min.js?ver=6.0.3:formatted:783 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
        at _ (acf-pro-blocks.min.js:783:51)
        at Array.map (<anonymous>)
        at acf-pro-blocks.min.js?ver=6.0.3:1419:24
        at o (acf.min.js?ver=6.0.3:1:1417)
        at Object.doAction (acf.min.js?ver=6.0.3:1:587)
        at n.doAction (acf.min.js?ver=6.0.3:1:18745)
        at post.php?post=1521&action=edit:3223:5

    Looks like it may be related to the “attributes” key so maybe I’m just doing something wrong but I’m unsure.

    Line 783 of acf-pro-blocks.min.js

    for (const t in e.attributes)
                        0 === e.attributes[t].default.length && delete e.attributes[t].default;
                    e.supports.anchor && (e.attributes.anchor = {
                        type: "string"
                    });
  • Apparently I’m doing something wrong with the attributes in my block.json. I’m not really sure what exactly but when I removed the attributes from the block.json all of my blocks appear in the admin.

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

You must be logged in to reply to this topic.