Add a related list using Pages

Suppose we have two related types of data – for example a movie database that has movies and actors. We can use the Node Reference module to link the Actors to the Movies that they are in. What we want is to be able to have a list of Movies that an Actor has appeared in listed on the Actor Node View page. We want to do this using the Pages module and use a “Context Pane”.

Step 1 – Create a View

  • Create a View normally to select the data you want to display and save this view. In the example stated, we want a list of movies”
  • Add a “Context Pane” display
  • Add a “Contextual Filter” – remember to use the “Administrative Title” to help anyone coming along later. In the example stated, we want the link to the Actor.
  • Add a “Argument Input” – Use “From Context” and select “Context ID”
  • In “Allow Settings”, select what settings you want to be able to change on the actual page. Remember this View can be used in several places and parts can be configured on each end-point.
  • Save

Step 2 – Enable Page Override

  • In Structure -> Pages, ensure the “Node View” override is enabled.
  • Add a new “Varient” with selection rules
  • Selection Rule Node:Type = whatever Content Type you are overwriting. In the example stated, We want the “Actors” content type.
  • In Contexts, make the variable visible to views.
  • Save

done

Leave a comment

Your email address will not be published. Required fields are marked *