toastnz/blocks
最新稳定版本:5.0.4
Composer 安装命令:
composer require toastnz/blocks
包简介
Silverstripe content blocks module
README 文档
README
Simple content blocks system. Nothing fancy, easy to implement.
Requirements
See composer.json
Installation
Add the following to your config.yml (optional):
PageController: extensions: - Toast\Blocks\Extensions\PageControllerExtension
Use Page or other class that extends SiteTree.
In your Layout/Page.ss template, add the following:
<% loop $ContentBlocks %>
$ForTemplate
<% end_loop %>
Configuration
Add / remove available block classes
Toast\Blocks\Extensions\PageExtension available_blocks: - Toast\Blocks\TextBlock
Create a custom block
Extend Block to create a new block type.
<?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
Todo:
- Template global providers
- Zoning
- Duplicate handlers
- Tests
Throughtables for more advanced versioning
统计信息
- 总下载量: 12.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-04-14