I have a Views 3 block whose block title I would like to set using PHP in the header section. This would enable me to use "tokens" from the views results, which is not possible from the UI.

In the case of a views page I was able to set the page title via the following PHP command in the header section:

$view = views_get_current_view();
$view->build_info['title'] = 'My Page Title';

However, I was not able to do the same thing for block titles via

$view = views_get_current_view();
$view->build_info['title'] = 'My Block Title';

The page and the block are subdisplays of the same view. The page view is the master view. Maybe views_get_current_view() only loads the master view? Is there a command to load a subview, in my particular case the block? Something like views_get_current_view()->subview?

Or maybe the build_info['title'] command only edits the page (or node) title. Does anyone know of an analogous command to set block titles?

Comments

semei’s picture

Issue summary: View changes

more precise description

mustanggb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closing this as outdated, feel free to re-open with updated details if it's still a problem in the latest release.