Simple content blocks system. Nothing fancy, easy to implement.
Add the following to your config.yml
:
Page:
extensions:
- Toast\QuickBlocks\QuickBlocksExtension
Optionally:
PageController:
extensions:
- Toast\QuickBlocks\QuickBlocksControllerExtension
Use Page
or other class that extends SiteTree
.
In your Layout/Page.ss
template, add the following:
<% loop $ContentBlocks %>
$ForTemplate
<% end_loop %>
Toast\QuickBlocks\QuickBlocksExtension:
available_blocks:
- Toast\QuickBlocks\TextBlock
Extend QuickBlock
to create a new block type.
<?php
namespace Toast\QuickBlocks;
class MyBlock extends QuickBlock
{
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/QuickBlocks/MyBlock.ss
:
<%-- Your block template here --%>
<h2>$Title</h2>
$Content
Through
tables for more advanced versioningModule rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem