انتقل إلى المحتوى

المعاينة

يتيح 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
}