xddesigners / page-content-block
Adds a page content block to SilverStripe elemental editor
Installs: 508
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- dnadesign/silverstripe-elemental: >=4.0
- silverstripe/cms: >=4.0
- silverstripe/framework: >=4.0
README
Adds a page content block to the elemental editor.
What it is
A Page content block is used to display the content from the Page model in the elemental area. This is useful for instance on pages like BlogPost's, UserForms or any page type that is added by a module.
For who it exists
For example, users editing blog posts want a lighter editing experience, but keep the flexibility of a block editor. This module sits in between by re-inserting the content field and moving the Elemental area to a Layout tab.
What it does
It simply renders the current page controller in an Element.
So you can access the page $Content
, $Title
or any other method on that element.
The PageContentBlock
is created on page creation so the element always exists.
The user can simply start typing in the content field and keeps the flexibility of adding any blocks around the PageContentBlock
.
Templating
The block searches for a block template closest matching the current page type.
It looks fot it's own class ancestry and adds "ContentBlock" to the end of the class name.
For example, for a BlogPost
it will search for a BlogPostContentBlock.ss
, if not found it will go down the ancestry until it will fallback to the PageContentBlock.ss
.
He will search in one folder namespaced to this module. The template folder path is templates/XD/PageContentBlock/Models/YourClassContentBlock.ss
.
Configuration
The creation of the PageContentBlock
is configurable, this module looks on the current page type for a config setting default_blocks
.
You could also use that setting to create a default banner block on BlogPosts
.
Page: default_blocks: - XD\PageContentBlock\Models\PageContentBlock BlogPost: default_blocks: - MyFeaturedImageBlockClass - XD\PageContentBlock\Models\PageContentBlock
If you don't want the re-inserting of the content field you can set the keep_content_field
setting to false
.
XD\PageContentBlock\Extensions\ElementalPageExtension: keep_content_field: false
If you want to disable the re-inserting of the content field on a specific class, for example the home page.
HomePage: hide_content_field: true