How to create ContentBlock with multiple text inputs?

375 views Asked by At

I'm using ContentBlocks from Modmore, and am trying to figure out how to create a new content block that has an input that allows the user to enter a title and another for a source URL. My goal with this is to expose these fields so that they can be edited from a resource, something like what is in the following image, with the second text field being where the red square indicator is.

enter image description here

This has been bugging me for a while, so I would appreciate if anybody can help with this.

1

There are 1 answers

2
Mark Hamstra On BEST ANSWER

First of all, you can get support for ContentBlocks and other modmore extras via the helpdesk ([email protected]) or our own forum (https://forum.modmore.com). I don't normally monitor StackOverflow, but luckily received an alert about your question.

There's a couple of options for what you're trying to do.

1) Add a field setting to your "IFrame" field. You can do this from the ContentBlocks component under Extras > ContentBlocks. Right click the field to update it, and on the Settings tab, add a text setting with a key/name of your choice. Then go back to the Templates tab, and use the [[+placeholder]] syntax to insert the value back into your template.

Depending on the "Expose Field" option you choose, the field can show up in a modal window available when clicking a settings icon on the field, or directly on the canvas like your red square indicator.

For more on this option, see the Settings section in the Fields documentation.

2) For more complex types of fields, you can also choose to use a Repeater field. These are a bit more complicated to setup, but allow you to combine not just the different field settings, but any supported input type in ContentBlocks, like images or even repeaters within repeaters.

While the repeater was originally meant for multiple rows of content (sliders, feature blocks, etc), you can set the minimum and maximum number of rows on the Properties tab when editing the field. Set them both to 1, and you have something better described as a Group field.

More detailed information about the Repeater can also be found in the documentation.

Hope this helps. If you continue to struggle with it, please get in touch via our normal support channels. :)