본문으로 건너뛰기

미리보기

Gutenberg를 사용하면 고정 블록 삽입기에서 블록 위에 마우스를 올렸을 때 블록을 미리 볼 수 있습니다. Blockstudio로 만든 블록의 미리보기를 사용하려면 example 키를 빈 객체로 설정하세요.

JSON
{
  "name": "blockstudio/native",
  "title": "Native Block",
  "category": "text",
  "icon": "star-filled",
  "description": "Native Blockstudio block.",
  "example": {},
  "blockstudio": true
}

사용자 지정 데이터

사용자 지정 속성이 올바르게 렌더링되도록 example 키에 구조화된 데이터를 제공할 수도 있습니다.

JSON
{
  "name": "blockstudio/native",
  "title": "Native Block",
  "category": "text",
  "icon": "star-filled",
  "description": "Native Blockstudio block.",
  "example": {
    "attributes": {
      "title": "This title will be shown in the preview"
    }
  },
  "blockstudio": true
}

PHP

PHP
<h1><?php echo $a['title']; ?></h1>

Twig

Twig
<h1>{{ a.title }}</h1>

InnerBlocks

블록이 InnerBlocks에 의존한다면 InnerBlocks 템플릿을 제공할 수 있습니다.

JSON
{
  "name": "blockstudio/native",
  "title": "Native Block",
  "category": "text",
  "icon": "star-filled",
  "description": "Native Blockstudio block.",
  "example": {
    "innerBlocks": [
      {
        "name": "core/paragraph",
        "attributes": {
          "content": "This is the default InnerBlocks block."
        }
      }
    ]
  },
  "blockstudio": true
}