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?

| improve this question | | | | |
  • Yes you can create a matrix block with no fields. You can delete the existing field and save it. I don't see any problem – Robin Schambach May 31 '18 at 22:00
  • No you can´t, it´s required. – Sebastián. Jun 4 '19 at 14:34
  • Too bad this seems not to be possible. There are use cases for sure. – Alex Kendrick Jan 30 at 22:53

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.

| improve this answer | | | | |
  • I'm with you on the higher level blocks... using <hr> was just an example for the sake of simplicity. The blocks I actually need this for are much more complex. For example, I have a 'Projects' block that if selected would render a grid of cards of all the project entries on the site. – Joe B Jun 1 '18 at 15:16
  • Ah I think it's great to use an entries field in that block, then the user is able to set the order of the projects themselves. You could also maybe make a custom field type in a plugin and attach that, potentially preventing the blank matrix block. – Clark Nelson Jun 2 '18 at 15:19
  • 1
    We have used entries fields in for some of our blocks, which works nicely, but in this case we do not want the user to have any control over order. I'm thinking the easiest way might be to simply hide the matrix field and using css. Not an ideal solution, though. – Joe B Jun 4 '18 at 17:08
  • This would be a nice addition, to control content blocks yourself without the requirement of some user input. – Sebastián. Jun 4 '19 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.