2

I'm trying to build a modular and quite dynamic backend. I'm using Drupal for the task but haven't been able to spin my head around how to make it happen.

I need ideas on how I might solve this rather complex task.


To explain what I would like to end up with, I've faked a screenshot showing in steps what I would like the end result to look like.

Step 1

Choose a module from the select box

Step 2

Fill out fields and possibly add another module


My client wants to display his different cases. To make each case different, he wants a system where he can pick and choose how parts of his content is displayed. I suggested a modular approach where he can choose a "module type" in a dropdown, and fill in the needed fields.

Some of the possible modules:

There are plenty more, but for the sake of this questions, lets just stick with those.


Needs:

  1. Possible amount of modules should be infinite.
  2. Possible to fill in all information on the different 'modules' on the 'case' page.

Do you have any idea on how this might be solved?

3 Answers 3

0

You can do this with the Field Collection module.

Add a field collection to your Case node and then add then add fields of the types you require to the field collection restricted to the amount of images or videos you want to display. An with the correct image styles assigned.

You could use the Field Group module to collapse the fields to improve the admin interface.

Edit:

Another option would be use Conditional fields module and add image fields to the case content type set the the amount of images to be displayed in each and the image style required. Then add a list field to the case content type with option on 1 image, 2 images, 3 images etc and then use Conditional fields to link this to display and hide the image fields.

5
  • Sorry - it's complex to explain, and even more so with no linebreak in my text. As you can see in my ref. image in "Step 1" it has a dropdown which determines how many fields should be visible. That part I could not figure out how to do in the "Field Collection"-plugin.
    – dnlmzw
    Commented Jul 31, 2014 at 14:11
  • I have added to my answer above
    – pete80
    Commented Jul 31, 2014 at 14:43
  • I think we've come very very close. Unfortunately the "Conditional Fields"-plugin does not seem to take effect. I have made a selectfield with the options, which should, when I choose an option make the group invisible. I figured it might have something to do with using it together with "Field Groups", however, having it disabled doesn't change much. Also I've chosen the standard admin theme and made sure that $scripts are printed in my html.tpl file without any luck.
    – dnlmzw
    Commented Jul 31, 2014 at 15:37
  • If conditional fields is not working well with field groups a few lines of javascript would do the job reacting on the change event of the select is to hide the image fields.
    – pete80
    Commented Aug 6, 2014 at 13:12
  • 1
    Hi again. First of all: Thank you so much for helping me out. I've made some progress since my last comment and have found a patch (drupal.org/node/1464950#comment-8419673) for my problem, which sorted out things. I didn't apply the patch but edited the code as it stated in the comment. I now get my intended outcome - again, really appreciate your help!
    – dnlmzw
    Commented Aug 7, 2014 at 14:12
0

You might be interested in this usage of Display Suite example video from Drupal Camp 2011 LA a few years back:

http://replay.uci.edu/clients/drupal/Advanced_Display_Suite_-Flash(Large)_-_20110806_01.59.54PM.html

If you watch the video he has dozen such templates for the client to choose how a page is displayed. I believe he had a way to set like the template from a field choice when building the node.

Of course you the programmer need to define the templates -- but using DS + Views as he does makes this easier to manage (in code).

1
  • 1
    Hi - I tried looking at Display suite, which unfortunately did not suit my needs (at least the examples shown in the video did not match my problem), but I managed to figure it out as you can see above. Thanks for helping though!
    – dnlmzw
    Commented Aug 7, 2014 at 14:14
0

There is finaly a module which does the work: Paragraphs

Same here

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.