pixelopen/kirby-customizable-layout

为 Kirby CMS 添加布局定制的插件

1.0.2 2024-07-01 08:58 UTC

This package is auto-updated.

Last update: 2024-08-31 09:20:12 UTC


README

GitHub release (with filter)

Dependency

Kirby CMS添加可定制布局字段的插件

商业使用

此插件是免费的

安装

下载

下载文件并将它们放入site/plugins/kirby-customizable-layout中。

Composer

composer require pixelopen/kirby-customizable-layout

Git 子模块

您可以将插件作为 Git 子模块添加。

$ cd your/project/root
$ git submodule add https://github.com/Pixel-Open/kirby-customizable-layout.git site/plugins/kirby-customizable-layout
$ git submodule update --init --recursive
$ git commit -am "Add Kirby Customizable Layout plugin"

运行以下命令来更新插件

$ cd your/project/root
$ git submodule foreach git checkout master
$ git submodule foreach git pull
$ git commit -am "Update submodules"
$ git submodule update --init --recursive

选项

要在蓝图添加可定制布局字段,您只需扩展fields/customizable-layout

目前,您需要在/site/config/config.php中添加以下行的字段集block-settings

return [
    'blocks' => [
        'fieldsets' => [
            'custom' => [
                'label' => 'Custom blocks',
                'type' => 'group',
                'fieldsets' => [
                    'block-settings',
                    // Other global custom blocks
                ]
            ],
          'kirby' => [
                'label' => 'Kirby blocks',
                'type' => 'group',
                'fieldsets' => [
                    'heading',
                    'text',
                    'list',
                    'quote',
                    'image',
                    'video',
                    'code',
                    'markdown'
                ]
            ]
        ]
    ]
];

在扩展字段时,您还可以添加自己的字段集,以添加block-settings块和您想要使用的所有其他块。

在使用插件的页面中不要忘记调用片段。

<?php snippet('customizable-layout', array('field' => $page->layout()))?>

该插件与 Kirby 4 的颜色字段兼容,您必须在/site/blueprints/fields/color.yml中创建新的字段,并添加您自定义的颜色。

type: color
mode: options
options:
  color1: "#color1"
  color2: "#color2"
  color3: "#color3"
  color4: "#color4"
  color5: "#color5"