I have a custom page that displays several nodes using node_view. If I use the 'full' view mode when calling node_view then my custom page will show its title. If I use a custom view mode when calling node_view then my custom page will not show its title.

I tracked this behavior down to ds_extras_process_page_title() and its use of drupal_static. Commenting out both lines that use drupal_static('ds_page_title') (one in the process page title, one in entity view alter) results in my custom page displaying its title as expected.

#1660358: Search Display page title is removed by ds_extras module... is related, but the fix doesn't seem to handle this use case.

I have included some sample code that helps explain the scenario I am talking about. It also includes a patch-less workaround for anyone else that may be experiencing this problem.

<?php
function MYMODULE_menu() {
    return array(
       
'test' => array(
           
'title' => 'David Copperfield',
           
'page callback' => 'MYMODULE_test_callback',
        )
    );
}
function
MYMODULE_test_callback() {
   
$ds_extras_hide_page_title = variable_get('ds_extras_hide_page_title', FALSE);
   
// Uncomment and the page title will display.
    // $GLOBALS['conf']['ds_extras_hide_page_title'] = FALSE;
    // Change view mode to 'full' and the page title will display (if allowed).
    // Change it to another view mode and it will not.
   
$items = array();
   
$items[] = node_view(node_load(1234), 'custom_view_mode');
   
$items[] = node_view(node_load(5678), 'custom_view_mode');
   
$GLOBALS['conf']['ds_extras_hide_page_title'] = $ds_extras_hide_page_title;
    return
$items;
}
?>

My expectation here is that the page title options provided by ds_extras would only apply to the actual entity being rendered and not a global context. Without digging into the code too much it seems as though $page_title returned by drupal_static should be an array keyed by bundles and view modes.

Comments

Issue summary:View changes

Added bit at the end

Version:7.x-1.7» 8.x-2.x-dev
Issue summary:View changes

Won't fix for D7, for D8 I need to recheck the title stuff as it changed a lot now.