A block type of your own
A "Notice" block in two looks (info, warning) that editors drag in like any other.
Life cycle: Build, example 35 of 35. Worked out on the Fit & Healthy site of Exponential 6.0.15+.
Contents
With templates
- Define
[BlockDefinition_notice]andAvailableBlocks[]=noticein your extension'sexplayouts.ini.append.php(since explayouts 1.4.42 the extension's place inActiveExtensions[]does not matter for blocks). - Write
explayouts/block/notice.tpl. - Clear Template & content and INI caches.
Then in the Layouts editor
- The palette's Basic group lists Notice.
- Drag it in, choose the view type and type the text on the Design tab.
- Publish layout. The pages that use the layout show the block on their next view.
Which to choose
Worth it as soon as the same markup would otherwise be copied into many HTML snippets.
Check
- The block renders
ngl-notice ngl-vt-<view type>.
Related pages
- Add a block type
- Build examples, every page
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.