I have a menu item and I want to call two functions on it. Here is my code.

$items['admin/proformative/reports'] = array(
	'title' => 'report',
	'page callback' => 'drupal_get_form',
	'page arguments' => array('test_reports'),
	'access callback' => TRUE,
	'type' => MENU_LOCAL_TASK,
  );

It works fine but in page_arguments i have call one function. And Now i want to call two functions. I change the above code as following but did not work.

$items['admin/proformative/reports'] = array(
	'title' => 'report',
	'page callback' => 'drupal_get_form',

'page arguments' => array('test_vbo', 'test_reports'),

	'access callback' => TRUE,
	'type' => MENU_LOCAL_TASK,
  );

But it only executes the test_vbo function and i want both to execute.

What should i need to achieve the above technique.

Comments

anil614sagar’s picture

# "page callback": The function to call to display a web page when the user visits the path. If omitted, the parent menu item's callback will be used instead.
# "page arguments": An array of arguments to pass to the page callback function.

Ideally you can call one function using page callback. If you want to call two function you just need to change logic little bit.. See my below code for example.



$items['admin/proformative/reports'] = array(
  'title' => 'report',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('test_reports'),  // calling function 1
  'access callback' => TRUE,
  'type' => MENU_LOCAL_TASK,
);

function test_reports() {
    $output = my_function_two();  // calling my second function here...

}

function my_function_two() {

}

Hope this helps..

Cheers,
Anil Sagar,
Lead Drupal Developer,
Azri Soulutions,
http://azrisolutions.com/