Friday, April 22, 2011

Dynamically display the title of page

<?php

 $items['tespage'] = array(
  'title callback' => 'custommodule_get_title',
  'title arguments' => array(1),
  'type' => MENU_CALLBACK,
  'page arguments' => array(5),
  'access arguments' => array('administer customworkflow'),
 );

/**
*Function to display the title dymnamically
*Parameters passed
*@param $arg
* Passing the id to get the custom name
*/
 function custommodule_get_title($arg){
  $arg = ($arg)?$arg:arg(1);
//Based on argument do the operation
  $name = custom_get_name($arg);
  return "Edit ".drupal_ucfirst($name);
 }

?>

No comments:

Post a Comment