Drupal - Modify the page title of view and set custom title for it

Found one that works

function MYMODULE_views_pre_render(&$view) {
  if ($view->name == 'menu') {
    $view->build_info['title'] = "TEST TITLE";
  }
}

I had a similar question in a slightly different context, When and where does Panels get the title out of a View?

My solution was

function foo_views_pre_view (&$view, &$display_id, &$args)
{
  $view->display[$view->current_display]->display_options["title"] =
  $view->display[$view->current_display]->handler->options["title"] = "Foo";
}

If I'm not mistaken, you cannot do that from the user interface. However, you can implement a hook in a custom module, take the available variables, apply your own logic and set the title you want.

You can find an example on Set page title for view in Drupal.

function HOOK_views_pre_render(&$view) {
  if ($view->name == 'taxonomy_term' && $view->current_display == 'page') {
    drupal_set_title('Your Page Title');
  }
}

Tags:

Views

7