I rebuilding my companies intranet... we have what's called a portal. Within the portal is pages. Each portal page is either HTML, a PDF or a Video.

Right now... I'm planning on creating 3 seperate content types. One with Text, one with a custom PDF Object for loading in browser and one for a video. So content types like:

PAGE content Type 
* Title 
* Image (Icon for content flagged News)
* Text with Teaser

PDF content Type  
* Title  
* Image (Icon for content flagged News)  
* PDF Object (loads PDF in browser) 

VIDEO content Type  
* Title  
* Image (Icon for content flagged News)  
* Video Field

FILEVIEWER content Type  
* Title  
* Image (Icon for content flagged News)  
* FileViewer Viewer

Notice... a lot of duplication.

What I'd like to do, and tell me if I'm stupid... is I'd like to have a drop down selector that shows the content type selected, while hiding the rest.

* Title  
* Image  
* Select List (Three, or more, choices: Text, PDF, Document, Video)
* Text w Teaser  
* Video Field  
* PDF Field  
* Fileviewer Field  

It will display the selected content type and hide the others when displayed on the actual node/block. This particular case is simply "Select One type", so I'm not worried about selecting combinations (ie: Text + Video)

I'd just much rather baby one content type... than 3+ content types with near identical layouts.

Question updated. Basically... it's my desire to have one content type instead of 4 (and possibly more). I'm not afraid to make my own custom module, although it would be a learning curve.

  • I do agree that it looks like a lot of duplication, but in practice I think the duplication is minimal. Drupal 7 stores it's data per-field, meaning that for instance all image fields in different content types will share a single table. – marcvangend Jun 13 '11 at 14:21

The obvious choice for that functionality would be the conditional fields module. It's still under development for D7, but you can check if it already supports your use case, or maybe you could even help the maintainer get the D7 version to a stable state.

  • I think this might actually do the trick. It is in "dev" status, so... taken with a grain of salt, it's letting me setup dependencies. – WernerCD Jun 13 '11 at 3:04
  • 1
    @WernerCD I +1 this solution as it's easier to maintain than a custom module/theme functions ;) – tostinni Jun 13 '11 at 13:41
  • Yeah... the main reason I was asking if something was out there was that I do want to learn to code some modules... but not yet :) – WernerCD Jun 13 '11 at 16:26
  • It's buggish... but this is spot on what I want. – WernerCD Jun 16 '11 at 17:46
  • @WernerCD: what kind of bugs have you experienced? I'm using it with satisfaction, but I'm curious. – Sk8erPeter Sep 16 '12 at 13:36

I'm not very sure I understand your question, let me rephrase it: you have a content type with fields and a select list. Regarding of the value of this select list, you want to display some fields and hide the others. Correct ?

If so, I would build my fields in a preprocess function and define some variables to display only the fields depending on the value of your select.

Can you clarify a little your question so I can update my answer ?

  • Question updated, but yes... your explanation was correct. – WernerCD Jun 13 '11 at 2:35

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.