2

I have a custom content type named "My content type".

I want to use a custom view to render a full content page for that content type. Currently I can only use a Default view that can be found in "Structure > Content types > My content type > manage display" but that is not what I want. I want to get rid of that and be able to use a custom view (from Views module).

How can I achieve that?

  • Do you mean you want to use a custom display/template to display each node of that content type, or build a view of the nodes of that content type? – kyletaylored Oct 15 '13 at 5:33
  • Want to use a custom view (created in Views module) to render a node's Full content page. Does that make sense? – Antonio Oct 15 '13 at 17:27
4

I would recommend you to have a look on the Display Suite module. This module allows you to add different view modes (displays) for your content. These view modes can then be used in several places. Beside that, the display suite module offers a lot of other very handy features to deal with any entity in your system and how they are displayed.

  • Thank you @Lance! While this is a very nice module, it's not quite that what I was looking for. Anyway lets say I can use that module to create a Full content display for my content type. My question is: How can I format the display of Collection field that I have in my node, with DS module? For instance a have a field collection that is composed of 3 fields: 1.School, 2.Graduation Year and 3.Degree. I want render those 3 fields in this format: "Harward, 2013, Bachelor". I guess I need to use field templates but can't figure out how to do that? – Antonio Oct 15 '13 at 17:38
  • 1
    @Antonio You can use Display Suite with that collection field to alter the display as well. The field collection will also have display settings and whenever you add the field collection to the Full Content display, select "Rendered Node" and then choose the display you created for the field collection. Does that make sense? Make a display for the field collection, then use that in the main content type display. – kyletaylored Oct 16 '13 at 5:22
  • @Lance, yes I see what you're saying, however, I could not find an option to format Field collection display the way I want it. In my case I need fied collection values to be delimited with commas. Just like this: "Harward, 2013, Bachelor". I guess a custom field formater would do the trick. – Antonio Oct 17 '13 at 22:46
  • Personally I would not use display suite for adding view modes because it is overkill. If you don't want to code a new view mode manually then drupal.org/project/entity_view_mode is a good alternative. – rooby Aug 15 '15 at 1:04
1

I have found 3 solutions. As a matter of fact, my question should have been formed a bit differently, pehaps: "How to override Drupal 7 node display with a View?"

Below are three solutions. (I prefer the first listed here. It's very simple and quick and I believe the right way of doing this. Also there is no need to instal any additional modules. Perhaps in some slightly different scenarios, solution 2. or 3. may be more appropriate.)

So here it is:

  1. Overriding node displays with custom template and embedding a view in template. See example here: What are the issues with overriding nodes with views?

  2. Use Panels module to override the node output See example here: http://jamestombs.co.uk/2011-08-18/use-panels-override-node-output-drupal-7

  3. Third option is to use Display Suite module, and then implement Dynamic Field option that renders a custom view. See more here: https://www.video2brain.com/en/lessons/using-display-suite-dynamic-fields

0

You may just configure the view to override the default Full Content view mode without changing the node template or using additional modules like DS or Panel.

This screenshot shows the configuration. The key is to override the default path and get the argument (nid) using a contextual filter.

Using a View as a Full Content view mode

  • This is only useful if you want to override all nodes on your site. It is not useful if you only want to override certain content types or some other subset of nodes. – rooby Aug 15 '15 at 1:06
0

A similar use-case scenario (which lead me here) not quite mentioned here is that you can add a new View of any content and simply make the Format (in the view) Show: Content | Full content. Set the path to whatever you like (or dynamically as in the above example) and 'bobs your uncle' as we say in the UK (means you're sorted).

In my use-case scenario I was looking for a way adding different content to a static URL based on Domain context (on a multisite build utilising the excellent Domain Access module).

I.E. the 'static' URL was "domain/where-to-go" and what I wanted to do was have Views add the Full Content (the full node) based in which 'domain' was requesting the page and so domain-x/where-to-go would load full content 'x' and domain-y/where-to-go would load page 'y' etc.

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.