Support

Account

Home Forums Gutenberg Show repeater-example in Gutenberg block

Solved

Show repeater-example in Gutenberg block

  • Hello,

    I am using the block.json to define my ACF Gutenberg blocks. Currently I am making a slideshow-block. I made an ACF slideshow field group that contains a repeater field with a WYSIWYG-text field (title) and image field (image).

    My block.json has the following code:

    {
      "name": "acf/slideshow",
      "title": "Slideshow",
      "description": "Show one or more images with text.",
      "style": [
        "file:./slideshow.css"
      ],
      "category": "media",
      "icon": "align-center",
      "keywords": [
        "slideshow"
      ],
      "acf": {
        "mode": "auto",
        "renderTemplate": "slideshow.php"
      },
      "example": {
        "attributes": {
          "data": {
            "slideshow": {
              "title": "This is an example text"
            },
          }
        }
      }
    }

    In the block editor when I want to select a block I will see an example of this block. I want the example to show the text: “This is an example text” (like defined in the block.json). But it only shows “T”, the first character of the string. What am I doing wrong?

  • Hello,

    If you change:

    “slideshow”: {
    “title”: “This is an example text”
    },

    to this:

    “slideshow”: [
    [
    [“title”, “This is an example text”]
    ]
    ]

    That should work.

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

You must be logged in to reply to this topic.