Score:1

How to subscribe to a view render event?

pn flag

I'm writing a module that will inject javascript into the page when a view is rendered. The contents of the javascript will depend on the results returned in the view, so ideally I would have access to that. I'm trying to use event subscriptions to do this. I have the getSubscribedEvents function set up but I'm trying to find a view render event to subscribe to. Is there such an event I can use?

id flag
Is it an Ajax view?
Andrew Clemens avatar
pn flag
@cilefen yes, it uses Ajax
Jaypan avatar
de flag
`Drupal.behaviors` fires all its child methods whenever AJAX loads new content into the DOM https://www.drupal.org/docs/drupal-apis/javascript-api/javascript-api-overview#s-example-using-drupalbehaviors
I sit in a Tesla and translated this thread with Ai:

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.