timoetting / kirby-builder
此软件包已被废弃,不再维护。未建议替代软件包。
这个多功能的Kirby CMS(v3)插件允许您预先定义不同字段集的内容块,然后可以在Kirby的面板内添加、编辑和排列。
2.0.16
2020-11-18 23:15 UTC
Requires
- php: >=7.1.0
- getkirby/composer-installer: ^1.1
- dev-master
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.0
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/tar-4.4.19
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/ini-1.3.7
- dev-dependabot/npm_and_yarn/dot-prop-4.2.1
- dev-dependabot/npm_and_yarn/safer-eval-1.3.6
- dev-dependabot/npm_and_yarn/acorn-5.7.4
- dev-dependabot/npm_and_yarn/mixin-deep-1.3.2
- dev-extandable_async_blocks
- dev-async_entire_fieldsets
- dev-Async-Builder-Blocks
- dev-composer
This package is auto-updated.
Last update: 2022-08-05 15:59:11 UTC
README
⚠️⚠️⚠️
此插件已过时且不再维护,因为其功能可以用本机块字段和布局字段替代。
⚠️⚠️⚠️
此多功能的Kirby CMS(>= v3.0.1)插件允许您预先定义不同字段集的内容块,然后可以在Kirby的面板内添加、编辑和排列。
Kirby 2的旧版本可以在此分支找到。
商业用途
Kirby Builder可以在许多不同的范围内使用。您最了解从这个插件中获得的价值有多大。请按您愿意的(和可以)的金额支付。
支持此插件的另一方式是通过此联盟链接购买Kirby许可证,您无需额外费用。您无论如何都需要那个许可证,对吧?😉
预览
安装
Git
从您的kirby项目的根目录开始
git clone https://github.com/TimOetting/kirby-builder.git site/plugins/kirby-builder
Composer
composer require timoetting/kirby-builder
直接下载
或者您可以下载zip文件,将其内容解压缩到site/plugins/kirby-builder。
示例蓝图结构
# inside the fields section of your blueprint: mybuilder: label: Page Builder type: builder columns: 1 # Optional. If set to 2 or more, the builder blocks will be placed in a grid. max: 10 # Optional. Limits the number of builder blocks that can be added. fieldsets: quote: # This is a field set. It contains a group of kirby fields. The user can select from these sets to build the content. name: Quote # The name option is used as a label for the buttons to add new fieldsets. It is also used as a label in the header of the fieldset, if the label option is not set explicitly (see next line). label: Quote by {{citation}} # Optional. The label option can be used to override the header text of the fieldset. The 'mustache' syntax can be used to include the value of any field of the fieldset. preview: # Optional. If defined, a preview of the fieldset can be rendered by the specified snippet from within the snippets folder. snippet: blocks/quote css: /assets/css/blocks/quote.css defaultView: preview # Optional. If the value "preview" is set, the block will show the preview when the page is loaded in the panel. If the value is a tab name, the respective tab is preselected when the page is loaded. Newly created blocks ignore this value and have the edit mode or the first tab preselected. fields: text: label: Quote Text type: textarea citation: label: Citation type: text bodytext: name: Text tabs: # Optional. Tabs can be used to group the fields of a field set. In this example, we use one tab to contain the content related fields and one for styling settings. It makes no difference for the content handling in the template if there are tabs or not. content: label: Content icon: edit # Optional. This icon appears next to the tab. The icon name can be chosen from the Kirby's icon set getkirby.com/docs/reference/ui/icon fields: text: label: text type: textarea style: label: Style icon: cog fields: fontfamily: label: Font type: select options: helvetica: Helvetica comicsans: Comic Sans fontsize: label: Font Size type: number events: name: Events preview: snippet: blocks/events css: /assets/css/blocks/events.css fields: eventlist: # The Builder Field can even be nested! type: builder label: Event List columns: 2 fieldsets: event: label: Event fields: title: label: Title type: text text: label: Description type: textarea date: label: Date type: date calltoaction: blocks/calltoaction # the Builder Field blueprint can be rather complex. It is therefore recommended to organize your fieldsets in single files. This example would take the content of the file /site/blueprints/blocks/calltoaction.yml and use it for the fieldset "calltoaction".
模板使用
在模板中使用构建器字段有不同的方式。一个干净的方法是在site/snippets/blocks/
中使用不同的片段,这些片段具有与蓝图中的字段集名称相同的文件名。在这种情况下,我们使用与面板内预览相同的片段。
<?php # /site/templates/yourtemplate.php foreach($page->mybuilder()->toBuilderBlocks() as $block): snippet('blocks/' . $block->_key(), array('data' => $block)); endforeach; ?>
toBuilderBlocks
方法将构建器字段转换为Kirby集合,这使得可以使用Kirby的链式语法。在底层,它是对toStructure
方法的别名。
例如,报价片段可以通过此片段呈现
<php # /site/snippets/blocks/quote.php ?> <section class="quote"> <blockquote> <?= $data->text() ?> </blockquote> <div class="citation"> <?= $data->citation() ?> </div> </section>