toastnz / blocks
Silverstripe content blocks module
Installs: 10 780
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 1
Open Issues: 4
Type:silverstripe-vendormodule
- 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-10-31 00:22:31 UTC
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
Through
tables for more advanced versioning