AnswerBun.com

Titles not showing for tabs pages

Drupal Answers Asked by AndyW on December 21, 2020

Below is the array in my hook_menu

The only issue that I have with it is that the titles are not displaying for tabs pages (the last three array collections).

They are showing the title for the parent: ‘Affiliate Hoover Home page’.

I’ve tried title callback instead but that isn’t working

$items['admin/config/affiliate_hoover'] = array(
    'title' => 'Affiliate Hoover Home page',
    'page callback' => 'drupal_get_form',
    'description' => 'This is the affiliate hoover homepage - add shit here',
    'access arguments' => array('access content'),
    'page arguments' => array('affiliate_hoover_first_form'),
    'file' => 'affiliate_hoover.home.inc',
    'menu_name' => 'Affiliate Hoover',
    'type' => MENU_NORMAL_ITEM,
    );

$items['admin/config/affiliate_hoover/uniquename/%'] = array(
    'page callback' => 'affiliate_hoover_unique_name',
    'access arguments' => array('access content'),
    'page arguments' => array(4),
    'file' => 'affiliate_hoover.uniquename.inc',
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
    'title callback' => 'affiliate_hoover_uniquename_title_callback',
    'title arguments' => array(4),
    );

$items['admin/config/affiliate_hoover/uniqueform/%'] = array(
    'page callback' => 'affiliate_hoover_unique_form',
    'access arguments' => array('access content'),
    'page arguments' => array(4),
    'file' => 'affiliate_hoover.uniqueform.inc',
    'type' => MENU_VISIBLE_IN_BREADCRUMB,
    'title callback' => 'affiliate_hoover_unique_form_title_callback',
    'title arguments' => array(4),
    );

$items['admin/config/affiliate_hoover/ajax'] = array(
    'type' => MENU_CALLBACK,
    'file' => 'affiliate_hoover.ajax.inc',
    'page callback' => 'affiliate_hoover_ajax_callback',
    'access arguments' => array('access content'),
    );

$items['admin/config/affiliate_hoover/'] = array(
    'title' => 'Home',
    'type' => MENU_LOCAL_TASK,
    'access callback' => TRUE,
    'weight' => -10);

$items['admin/config/affiliate_hoover/delete'] = array(
    'title' => 'Delete',
    'type' => MENU_LOCAL_TASK,
    'file' => 'affiliate_hoover.delete.inc',
    'page callback' => 'affiliate_hoover_delete_page',
    'access callback' => TRUE,
    );

$items['admin/config/affiliate_hoover/log'] = array(
    'title' => 'Log',
    'type' => MENU_LOCAL_TASK,
    'file' => 'affiliate_hoover.log.inc',
    'page callback' => 'affiliate_hoover_log_page',
    'access callback' => TRUE,
    );

$items['admin/config/affiliate_hoover/tracking'] = array(
    'title' => 'Tracking',
    'type' => MENU_LOCAL_TASK,
    'file' => 'affiliate_hoover.tracking.inc',
    'page callback' => 'affiliate_hoover_tracking_page',
    'access callback' => TRUE,
    );

return $items;

2 Answers

There is drupal_set_title you can try this in menu callback functions.

drupal_set_title($title = NULL, $output = CHECK_PLAIN);

Parameters

$title: Optional string value to assign to the page title; or if set to NULL (default), leaves the current title unchanged.

$output: Optional flag - normally should be left as CHECK_PLAIN. Only set to PASS_THROUGH if you have already removed any possibly dangerous code from $title using a function like check_plain() or filter_xss(). With this flag the string will be passed through unchanged.

Return value

The updated title of the current page.

Answered by niksmac on December 21, 2020

If you have static titles of submenus I suggest you to return using 'title' value in array.

I guess: set static titles and 'title callback' to false.

Answered by Codium on December 21, 2020

Add your own answers!

Related Questions

Make node only accesible by path alias

3  Asked on November 19, 2021 by kevin-ramirez-zavalza

     

Form and gated content

1  Asked on November 17, 2021 by dataguy

 

Calculate Star rating based on webform submissions

1  Asked on November 17, 2021 by brainhax

 

Pager not working when $form[‘table’] is called with AJAX

1  Asked on November 17, 2021 by user3428971

     

Send message notification when license expired

1  Asked on November 15, 2021 by learner123

 

View filtering, Relationship Vs Contextual filter

1  Asked on November 15, 2021 by bassem-mohamed

   

Missing some block fields

1  Asked on November 15, 2021 by metalbearsolid

   

Custom template for each profile2 profile type edit form

1  Asked on November 13, 2021 by stavovei-ciprian

       

How to save an image resource

1  Asked on November 13, 2021 by kosher

 

How to alter node body content through Views pre render hook?

1  Asked on November 11, 2021 by pramodg

 

Set Default Value for Image Field contain Multiple Images

1  Asked on November 11, 2021 by pglatz

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP