Skip to main content
Commonmark migration
Source Link

Reading hook_menu it says this:

"title": Required. The untranslated title of the menu item.

 

"title callback": Function to generate the title; defaults to t(). If you require only the raw string to be output, set this to FALSE.

 

"title arguments": Arguments to send to t() or your custom callback, with path component substitution as described above.

So how to use it? Right now i have this

function custom_gmap_neo_menu(){
    $item = array();

    $item['custom_gmap_neo/%/%/%'] = array( // hotel/origin/destination
        'title' => 'Get directions to @hotel',
        'title arguments' => array(1),
        'page callback' => 'custom_gmap_neo_show',
        'page arguments' => array(1,2,3),
        'access callback' => TRUE,
    );

    return $item;
}

function custom_gmap_neo_show($hotel, $origin, $destination){
    dpm($hotel);
    dpm($origin);
    dpm($destination);

    return '';
}

So knowing that default function for title callback is t() how to actually pass the @total wildcard to the t() function?

Reading hook_menu it says this:

"title": Required. The untranslated title of the menu item.

 

"title callback": Function to generate the title; defaults to t(). If you require only the raw string to be output, set this to FALSE.

 

"title arguments": Arguments to send to t() or your custom callback, with path component substitution as described above.

So how to use it? Right now i have this

function custom_gmap_neo_menu(){
    $item = array();

    $item['custom_gmap_neo/%/%/%'] = array( // hotel/origin/destination
        'title' => 'Get directions to @hotel',
        'title arguments' => array(1),
        'page callback' => 'custom_gmap_neo_show',
        'page arguments' => array(1,2,3),
        'access callback' => TRUE,
    );

    return $item;
}

function custom_gmap_neo_show($hotel, $origin, $destination){
    dpm($hotel);
    dpm($origin);
    dpm($destination);

    return '';
}

So knowing that default function for title callback is t() how to actually pass the @total wildcard to the t() function?

Reading hook_menu it says this:

"title": Required. The untranslated title of the menu item.

"title callback": Function to generate the title; defaults to t(). If you require only the raw string to be output, set this to FALSE.

"title arguments": Arguments to send to t() or your custom callback, with path component substitution as described above.

So how to use it? Right now i have this

function custom_gmap_neo_menu(){
    $item = array();

    $item['custom_gmap_neo/%/%/%'] = array( // hotel/origin/destination
        'title' => 'Get directions to @hotel',
        'title arguments' => array(1),
        'page callback' => 'custom_gmap_neo_show',
        'page arguments' => array(1,2,3),
        'access callback' => TRUE,
    );

    return $item;
}

function custom_gmap_neo_show($hotel, $origin, $destination){
    dpm($hotel);
    dpm($origin);
    dpm($destination);

    return '';
}

So knowing that default function for title callback is t() how to actually pass the @total wildcard to the t() function?

Source Link

How to use hook_menu title arguments

Reading hook_menu it says this:

"title": Required. The untranslated title of the menu item.

"title callback": Function to generate the title; defaults to t(). If you require only the raw string to be output, set this to FALSE.

"title arguments": Arguments to send to t() or your custom callback, with path component substitution as described above.

So how to use it? Right now i have this

function custom_gmap_neo_menu(){
    $item = array();

    $item['custom_gmap_neo/%/%/%'] = array( // hotel/origin/destination
        'title' => 'Get directions to @hotel',
        'title arguments' => array(1),
        'page callback' => 'custom_gmap_neo_show',
        'page arguments' => array(1,2,3),
        'access callback' => TRUE,
    );

    return $item;
}

function custom_gmap_neo_show($hotel, $origin, $destination){
    dpm($hotel);
    dpm($origin);
    dpm($destination);

    return '';
}

So knowing that default function for title callback is t() how to actually pass the @total wildcard to the t() function?