Score:0

Possible use case for hook_views_query_alter or hook_views_data_alter

hk flag

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?

Jaypan avatar
de flag
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?
apaderno avatar
us flag
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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.