How to tell if you are on a view page in preprocess_page I am trying to see if we are on a view page in the preprocess_page function in my MYTHEME.theme file.

views_get_page_view() gives me an undefined function error. 

I want to get values from my view to display outside the view area in page.html.twig
That function will error because it does not exist in Drupal 8.

You can do this though:

$view_id = \Drupal::routeMatch()-&gt;getParameter('view_id');
$view = \Drupal\views\Views::getView($view_id);


Be sure to validate view_id first though, that it exists/length before calling the second line.