I have two pages, the first page 'test' has links to test/%. On test/% I want to have different titles but some how this wildcard and the title callback aren't working properly.
/**
* Implements hook_menu().
*/
function cjgimport_menu() {
$items['test'] = array(
'title' => t('Test title'),
'title callback' => 'function_title_callback',
'title arguments' => array(0),
'type' => MENU_NORMAL_ITEM,
'access arguments' => array('access content'),
'page callback' => 'function_content_callback',
);
$items['test/%'] = array(
'title' => t('Test title'),
'title callback' => 'function_title_callback',
'title arguments' => array(1),
'type' => MENU_NORMAL_ITEM,
'access arguments' => array('access content'),
'page callback' => 'function_content_callback',
);
return $items;
);
/**
* Custom callback function for title
*/
function function_title_callback($arg) {
if($arg == 0) {
$title = ucfirst(arg(0));
} else {
$title = ucfirst(arg(1));
}
return $title;
}
Can anyone tell me why the title doesn't work on the test/% pages?
dpm($arg)
, do you see what you expect to see?