Get current pageview in drupal

How to get a view of the current page in drupal.

I have a filter, when a user enters a search item, the view changes.

$view = views_get_current_view();

does not work.

+3
source share
2 answers

This worked for me:

$view = views_get_page_view();
+6
source

Depending on the situation, the data should be in

$page_data = page_manager_get_current_page();

when calling from MYTHEME_preprocess_page().

You may need print_rdata, but I think the view name will be set to $page_data['handler']->subtask. I used to use this in themes, but depending on how your site integrates, this may not always work.

+1
source

Source: https://habr.com/ru/post/1786535/


All Articles