İçeriğe geç

Önizleme

Gutenberg, sabit blok ekleyicide bir bloğun üzerine gelindiğinde bloğun önizlemesini gösterir. Blockstudio ile oluşturulan blokların önizlemesini etkinleştirmek için example anahtarını boş bir nesneye ayarlamanız yeterlidir.

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

Özel Veriler

Özel özniteliklerin doğru biçimde oluşturulması için example anahtarında yapılandırılmış veri de sağlayabilirsiniz.

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

Bloğunuz InnerBlocks öğesine bağlıysa InnerBlocks için bir şablon sağlayabilirsiniz.

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
}