1

in my Sections (Single, Channel and Structure) I am using one matrix field containing typical content elements, Text (One Column), Text (Two Columns), Image, Text-Slider, Image-Slider and so on...

My problem is the Text-Slider with Richtext and links in it. Unfortunately Matrix field doesn't offer any Repeater or Nested Matrix functionality so I don't know how to build the structure for this element.

My Image-Slider is a no brainer , I take an asset field and with every image there is another Richtext field I can use.

The Table field has no Richtext field in it... There are a lot of small Text-Sliders all over the website. Any Ideas? Thanks much!

1 Answer 1

1

You could use your default "Text" Matrix block type for the sliders and have an extra block type as a "Slide Wrapper", to wrap "Text" (and "Image") blocks which should go into your slider.

See this question for an alternative approach, to recognize succeeding blocks of the same type automatically in the template Solution for Matrix-within-Matrix (or More Robust Table Fields).

5
  • It is not the most elegant solution to use special block elements to wrap the slider elements but for now it is working fine. Hopefully craft will get nested elements, like structured matrix or a kind of repeater field.
    – Patte
    Apr 16, 2015 at 11:14
  • Yep, it's not elegant but as you could make it work to use all your other block types in between, it is very flexible. If you're not liking that extra block you could probably also use a boolean field "Begin / End Slider" that's available on your text block type. Not exactly sure if this would make things more elegant though?
    – carlcs
    Apr 16, 2015 at 11:22
  • Ah, I like that boolean field thing! Thanks for that hint.There are just rich text fields in my Text Slider so this would be a good way to clean up.
    – Patte
    Apr 16, 2015 at 15:15
  • Hey Patte, if it's only for the text blocks I'd seriously consider the technique Brandon posted (linked question). Then you wouldn't need anything to group them and do it all with Twig magic in your templates.
    – carlcs
    Apr 16, 2015 at 16:35
  • You`re right. I addition to that I realized that I will need an image slider, too, so I decided to use wrap elements. It is working very well, thanks much!
    – Patte
    Apr 17, 2015 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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