Score:0

How can i get the fields of a view which has contextual filter inside views_view_field hook in drupal 9?

in flag

I have a drupal 9 site. I have a parent view A and a child view B. I am using views_field_view contrib module in order to pass an id from view A to view B. I have added a contextual filter in B to get this id from A. I want to fetch this id in my views_view_field hook and do some modifications based on the id fetched. But i am not able to get inside the view B in my views_view_field hook. If i remove the contextual filter from view B, then i am able to go inside the view in my code. But i need that id from the filter, I can't remove that because all the modifications are happening based on that id only.

Here is my code:

function mymodule_preprocess_views_view_field(&$variables){ $view = $variables['view']; if($view->storage->id() == 'B'){ //print something } }

But when i go to the path of view B, it prints nothing. Can anyone please help how to resolve this issue?

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.