We have an Event content type that uses a custom module to allow events to occur on more than one date. We have a View of teasers that displays a list of all upcoming events, each teaser displays all the occurrences the event will take place. The only problem is, the View displays each event one time in the list for each occurrence, but we only need it to show once because it already displays all the dates on the first occurrence.

I'm wondering if either hook_views_query_alter or hook_views_data_alter would be good candidates for looping through the events in the array to find instances that share the same title, and then use it to limit the list display to one instance?

  • Please give more information on the architecture of your events. How can one event occur multiple times - are these revisions on the event? Multiple date fields? Multiple event nodes with a common ID?
    – Jaypan
    Aug 9, 2021 at 18:14
  • As general rule, hook_views_query_alter() is for altering the query ran by a view, hook_views_data_alter() is for altering how module data is exposed to the Views module. In your case, it seems you want to implement the first one.
    – apaderno
    Aug 9, 2021 at 21:48


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.