1

here is my question:

I have two content types, Events and City.
The goal here is to "connect" content of type "Events" with a city, so that, when i publish content of type "City", to include the logo (image field) of the referenced city.

What i have done till now:
I have used the field reference module, creating a "field_reference" field on Content Type "Events". At its configuration, i chose the desired "logo_field" from the "City" content Type, but only the name of the city logo appears, and not the logo itself (on node page). The same appears when i want to use this field in a view.

Any ideas?

  • Have you investigated the Field Display for this specific field? – alex laughnan Jun 9 '15 at 15:39
  • I am using the display_suite for displaying nodes, and there it is set up as it should in the "Events" content type. The "logo" field display is also set up properly in the "City" content type (where it was initially). – kiko77 Jun 9 '15 at 15:45
  • Use a combination of Entity Reference and Display Suite and Views. Display Suite has a dynamic field to display the output of a view and pass in context to that view. drupalize.me/videos/display-suite-fields?p=1141 – J. Reynolds Jun 9 '15 at 16:33
  • @J.Reynolds Thanks a lot for that video-tutorial. very very useful! – kiko77 Jun 9 '15 at 16:53
1

Have you tried to use Entity Reference?

With this module, you can first add a connection between to entities, and then you may be able to create a contextual view of selected field of the connected entity where needed.

  • Thanks for your answer, i have used entity reference some time ago, but for that task it seemed to me much simpler to use the field_reference. If i won't come up with a solution including field_reference soon, i will try the entity_reference way. – kiko77 Jun 9 '15 at 15:54
  • 1
    I tend to agree with Entity Reference. – alex laughnan Jun 9 '15 at 15:58
0

This would be a great case for creating a taxonomy vocabulary. An event begins and ends but a "city" can be considered pretty solid.

What you would do:

  • Create a new taxonomy vocabulary called cities.
  • Add your cities to it as items
  • In your EVENTS create a term reference field for cities - this will list all the cities in your taxonomy as you have entered them before. So when you create an event you can select the city it is happening in.

Now, taxonomies kind of work like nodes; you can add fields to them such as an image field - so if you add an image field to your taxonomy vocabulary (ie. Statue of Liberty image for New York; Eifel Tower image for Paris), this means that you would always have that standard image for a particular city.

Finally, using Views, you can now control the output of a node based on it's taxonomy (the city) and hence include that image every time - based on your event's location. It is going to take a little research in achieving this, but it is the way you would do it - especially if your find yourself constantly listing events - this would end up automating this process for you.

0

On this page is a good example on your question https://www.drupal.org/node/1841004

The examples is "Using Views Contextual Filter and Relationship to display reference on referenced node"

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.