0

For my next drupal project I need more flexibility in content-styling, than the standard approach allows. I need to be able to build the content-body for every single node from different elements. Like in TYPO3 I need a sandbox of pre-styled elements (e.g. full screen image, two column text, 3 boxes side by side, etc) and be able du add as many different elements as I want. The markup and styles should be saved in my theme, so there should not be any html in the content fields.

e.g. example

EDIT 1: Its basicly something like the Form builder what I am searching for. (see comments)

Usualy I have used an WYSIWYG editor whith shortcodes, insert module and predefined styles, but I learned that it is not a good practice.

My approach which atm only work in the theory:

  1. I use Field collection module for being able to add unlimited blocks of the collection.
  2. Whithin the field collection I have one select-box where I define the template_name for the collection.
  3. Than I add all the fields I need (e.g. text, image, backgroundimage, date) to the collection
  4. With the Conditional Fields module I controll which fields are needed/shown for every single template (see select box).

    Screenshot 1 // Screenshot 2

  5. The theming is done in my field-collection-template file (if template_name == x, render this whithin particular markup)

Unfortunately this is really complicated ( I have to make a dependies for every single field in any template).

is there any better solution?

6
  • 1
    So you are looking for Form Builder-like solution, but for nodes instead?
    – Mołot
    Aug 7, 2014 at 14:10
  • 1
    I haven't ever used it but isn't that what Display Suite does?
    – Clive
    Aug 7, 2014 at 14:13
  • 1
    Sadly, I don't know anything like that, but you could try to use it's source code or cooperate with it's author. It's actively maintained and developed, and it's open source, so you might want to try. I'd like to see module like that. EDIT: I totally forgot DS - never used it, but maybe?
    – Mołot
    Aug 7, 2014 at 14:13
  • 2
    @Clive: no, display suite let you choose a template for the whole node, but does not allow you to add unlimited template-blocks. Aug 7, 2014 at 14:17
  • 1
    @Clive you can make a ton of templates and control them via Display Suite, this recording from DrupalCampLA they made almost hundreds of DS templates for 1 node type. It's an interesting way to store alot of templates for a type of node. drupal.stackexchange.com/a/125084/3279
    – tenken
    Aug 7, 2014 at 16:51

2 Answers 2

0

What about using entity references. You mention the field-collection approach, which has the same overhead as using entity references.

Basically you create a few node types that each conform to a different block element that you require. Then you create a master node with an entity reference field and select all of your block element node types as candidates, and set the filed count to unlimited. Then also use the inline entity form.

This will work but has a heavy server load.

2
  • 1
    With proper caching strategy server load of collection and references is not an issue
    – Mołot
    Aug 7, 2014 at 15:04
  • This seem to me quite complicated and not very practicable for the editor. In the end this whole thing should make the editing easy and neat Aug 11, 2014 at 8:40
0

The solution ist called Paragraphs!

It is still in the development, but looks pretty stable. even works with features!!

enter image description here

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