toastnz / blocks
Silverstripe内容块模块
5.0.4
2023-07-15 08:20 UTC
- dev-main
- 303.x-dev
- 200.x-dev
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.0
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.2
- 1.1.1
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6.x-dev
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.1
- dev-ss5
- dev-dependabot/composer/silverstripe/framework-4.12.5
- dev-dependabot/composer/silverstripe/admin-1.13.0
- dev-dependabot/composer/guzzlehttp/psr7-2.5.0
- dev-dependabot/composer/silverstripe/assets-1.11.1
- dev-master
- dev-automation-test
This package is auto-updated.
Last update: 2024-08-31 00:27:59 UTC
README
简单的内容块系统。无特殊功能,易于实现。
要求
查看composer.json
安装
将以下内容添加到您的config.yml
中(可选)
PageController: extensions: - Toast\Blocks\Extensions\PageControllerExtension
使用Page
或扩展自SiteTree
的其他类。
在您的Layout/Page.ss
模板中添加以下内容
<% loop $ContentBlocks %>
$ForTemplate
<% end_loop %>
配置
添加/移除可用的块类
Toast\Blocks\Extensions\PageExtension available_blocks: - Toast\Blocks\TextBlock
创建自定义块
扩展Block
以创建新的块类型。
<?php class MyBlock extends Toast\Blocks\Block { private static $singular_name = 'My Block'; private static $plural_name = 'My Blocks'; private static $icon = 'mysite/images/blocks/custom.png'; private static $db = [ 'Content' => 'HTMLText' ]; }
/themes/default/templates/Toast/Blocks/MyBlock.ss
:
<%-- Your block template here --%>
<h2>$Title</h2>
$Content
待办事项
- 模板全局提供者
- 分区
- 重复处理程序
- 测试
- 使用
Through
表进行更高级的版本控制