Craft CMS Asked by Joe B on December 4, 2020
Is it possible to create a matrix block with no fields? I’m using matrix as a page builder and have several scenarios where certain matrix blocks simply act as true/false checks.
As an example, my Horizontal Rule block simply adds an ‘< hr >’ tag to the page. No fieldtype is needed for this block.
I can add a dummy text field to the block that does nothing, but this is not too elegant. Any ideas?
I tend to design my matrix block at a slightly higher level. I would have a text block with the rich text editor that allows you to enter a <hr/>
tag. You can obviously also use this for all other text on the page, no need for multiple text style blocks.
You would add new block types for rich media components like galleries, videos, widgets, etc.
I know this is not exactly what you are looking for, maybe someone else will have an approach that works for your scenario.
Answered by Clark Nelson on December 4, 2020
When you create a matrix block type it pre-populates it with a blank field. If you delete this blank field and click save you can have a block with no fields.
Answered by patrick.altair on December 4, 2020
I've achieved this using this plugin.
It might sound like overkill to use a plugin for something so simple, but I've found this "Entry Instructions" fieldtype to be very handy in a lot of different places too. It supports markdown and css styling, and stands out a bit more than the default instructions.
Answered by Nick on December 4, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP