TransWikia.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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP