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?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.