-1

I am editing a large Drupal 7 website. In a part of this site, decisions are shown. Each decision can contain related decisions. There is a custom content type decision, in which there is a field that can link to other decisions (this is done by using the module Entity Reference).

The problem is, when the web page is generated, I want to see the related decision's short title (this is a subfield of the content type decision). By default the decision's 'normal title' is shown. The output should be something like this:

Type of rule Decision Gvt
Status Permanent
Date 12/11/2012

Text goes here.

Link decision link

Related decisions Not the title (system name: title), but the short title (system name: field_verkorte_titel) should be shown here.

Let me explain this by showing a screenshot of the content type decision (=beslissing overheid)

screenshot content type decision

The red circle is what is shown now when the related decisions are shown. The title field (system name: title) is shown here.

The green circle is the field that should be shown, the short title (system name: field_verkorte_titel).

The yellow circle is the entity reference field, done with Entity Connect). Here a decision can link to an other decision.

I've looked up so much information, but I'm fairly new to Drupal, and it seems I'm not getting nowhere at this moment. Is there anyone who can push me in the right direction?

King regards

0

This will take a few steps.

  1. Define an extra view mode, say 'short title'. Refer to How do I add additional view modes for a node?.
  2. Format the short title view mode for the related decision so as to just show the short title field.
  3. Suppress the regular title on that view mode by making sure the Display Suite Extras module is enabled then using the hide title option (see Display Suite Extras)
  4. Change the display settings for the reference field to be 'rendered entity' with the view mode of 'short title'.

This is a summary rather than a detailed set of instructions but should be enough to get you underway. It's also possible to solve this problem in the theme but this way you should not have to write any code.

Addendum: you might need a little CSS to make the title appear inline.

  • This does not seem to work. Do you have any other ideas I could try? I've tried so much but it still is not changing the output to what I would like. – Stefan Eeckhoudt Aug 14 at 12:05
  • What are you getting instead of what you want? – Alfred Armstrong Aug 14 at 13:51
  • Everything seems to go fine,, but after doing '4. Change the display settings for the reference field to be 'rendered entity' with the view mode of 'short title', nothing seems to be altered even when I've set my custom view mode to only show the short title, it still outputs the default title field. – Stefan Eeckhoudt Aug 19 at 9:23
  • So you used the 'hide title' option, but it didn't work? – Alfred Armstrong Aug 19 at 12:50
  • I didn't use the hide title option yet, as changing the view i enter in the rendered entity view does not change anything. Let me rephrase the question: I have a node of content type x that refers (via entity reference) to a node of content type y. After linking node x tot node y and saving the node, Drupal shows node title y. But I want Drupal to show a specific field of node y (with link to node y) rather than the title field. How can I achieve this? – Stefan Eeckhoudt Aug 19 at 12:56

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.