function profile2_page_preprocess_page in Profile 2 7.2
Same name and namespace in other branches
- 7 contrib/profile2_page.module \profile2_page_preprocess_page()
Implements hook_preprocess_page().
Fix the page titles on the profile view pages. We want the titles to be the full profile label, giving the user name & profile name.
Note: the title for the separate edit page is already correct.
File
- contrib/
profile2_page.module, line 480 - Adds separate pages for viewing and editing profiles.
Code
function profile2_page_preprocess_page(&$vars) {
// This is true for profile2 view pages, both as a tab and a separate page.
if (!empty($vars['page']['content']['system_main']['profile2'])) {
// Get the one item, index is unknown..
$item = reset($vars['page']['content']['system_main']['profile2']);
// If we've found an item, and it has a profile2 entity, display the title.
if (!empty($item['#entity'])) {
$vars['title'] = $item['#entity']
->label();
}
}
}