Skip to content

Instantly share code, notes, and snippets.

@ss81
Last active October 12, 2015 19:58
Show Gist options
  • Save ss81/4079378 to your computer and use it in GitHub Desktop.
Save ss81/4079378 to your computer and use it in GitHub Desktop.
How to change the title of a Drupal View via code
<?php
function customModule_views_pre_render(&$view) {
if ($view->name == 'view_name' && $view->current_display == 'display_id') {
// Here you can do any php you want to get the title you need for your view.
$view->build_info['title'] = "My custom title!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment