Using view modes to display multiple content types

pixelupper's picture

I have 2 content types

Article: Basic content type with standard text fields
Link: using the title field and URL field to re-write the view output (The purpose for this content type is to link external content that is relevant to the article)

The goal is display the related content (either an article or link) to an existing article using the node reference field.

Here is an image to explain

I was hoping somebody could point me in the right direction on how to accomlish this with display suite. I was thinking I could use a view mode but I'm not familiar on how to tie in multiple content types in 1 display.

Any ideas or better ways to do this are more than welcome :-)

Thanks.

Comments

Field templates

Lars Bo Jensen's picture

Hello pixelupper,

I am not sure if I understand you right, but the following will display your referenced articles and links in an HTML list with a CSS class of your choice and also let you control the display of the header and the container of header and list.

Enable Field Templates at admin/structure/ds/extras

Manage display -> select a Display Suite display for your display type.

Under your entity reference field, select Field display: expert -> Set field items to ul and set a class for the ul. Set Field item to li. Update. Click the cog at the right and check for linking label to referenced entity. Save.

You need to place your block header and the list inside some region. Add style classes at admin/structure/ds/styles, select a DS layout for your display with more than one region and select your class(es) at the bottom under "Extra classes for regions".

You may also want to try out the Field Group module: https://drupal.org/project/field_group It's briliant.

Edit your CSS and enjoy (I hope).

Thank You Lars for taking the

pixelupper's picture

Thank You Lars for taking the time and posting this I really appreciate the help and so far you suggestion worked great! Except for the output of my link content type. When I output the link content type it just links to the node instead of the url field how can I re-write the output in DS to link title to the URL field in the content type

I have 2 fields in the link content type

Title
URL

Link module

Lars Bo Jensen's picture

Okay, now I get it, but I don't think you can do do that via the DS UI, and I don't think it's a good idea. Having a content type just in order to add links to another content type seems wrong.

I run a website with a content type "Link", but that's in order to display some links as pages with path, title, URL, body text field with abstract, images and tags.

In your case, I suggest using the link module and add a link field to your article type (and then delete your obsolete link content type). Then you can do what you want :-) https://drupal.org/project/link

Thank You Lars this worked

pixelupper's picture

Thank You Lars this worked great

Display Suite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week