how to call two functions from a menu item?
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 as 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,
'ty开发者_如何学编程pe' => 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.
Your page callback is drupal_get_form, which renders the form that is returned from the page argument, which is the test_vbo function. If you want to render multiple forms, you can wrap the drupal_get_form calls in single function and use that as the page callback:
$items['admin/proformative/reports'] = array(
'title' => 'report',
'page callback' => 'test_my_function',
'access callback' => TRUE,
'type' => MENU_LOCAL_TASK,
);
function test_my_function() {
return drupal_get_form('test_vbo') . drupal_get_form('test_reports');
}
精彩评论