1

I am using a code

<?php
print $view->display['view_machine_name']->handler->options['title'];
?>

I put machine name in view_machine_name and everything work but I have few displays with different machine names and in other cases I still print same title. Can I get a function which takes the view machine name?

2

You can try views_get_page_view() function, Which return Views object and you can get current views name on $views_page->name

  • I displayed title using: $title = $view->get_title(); print $title; Thank you for help. – Michael D Apr 26 '14 at 11:50
  • And in drupal 8? in lets say the hook_preprocess_page function? – Raf A. Oct 15 '17 at 19:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.