I have one menu and two functions that want to call on same menu. What I am doing is, in hook_menu page callback i am calling a function and in that function i am calling another function.Means, calling function inside a function in page callback of menu. Now my PROBLEM IS, my secong function is a form.

$items['component/%/edit'] = array(
    'title' => 'Edit Component item',
    'page callback' => '**component_list_edit**',
    'page arguments' => array(3),
    'access arguments' => array('administer users'),
    'file' => 'popup.inc',
    'type' => MENU_CALLBACK,

My Page callback:

 * ajax popup edit function : ctools implementation
function component_list_edit() {
  return _mid_component_make_link('Title').component_type_select_list_form($form, $form_state);

It is giving "ARRAY" as an output. no form m getting. I also tried to return drupal_get_form('component_type_select_list_form'); This is also not working.


1 Answer 1


After some sort of study, I got to the answer. we can get form by using drupal_get_form and then in return function, we need to render it also. for example:

function component_list_edit() {
  $form = drupal_get_form('component_type_select_list_form');  
  // Load the modal library and add the modal javascript.
  return '<div class="title_display">Title:'._mid_component_make_link('Title').drupal_render($form).'</div>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.