Drupal hook menu and node form

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
cithukyaw's picture

I have a content type 'leg'and this hook_menu :

$items['leg'] = array(
    'title' => t('Choose Leg'),
    'page callback' => 'drupal_get_form',
    'access arguments' => array('create leg content'),
    'page arguments' => array('mymodule_leg_select_form'),
    'type' => MENU_NORMAL_ITEM,
    'weight' => 0,
);

$items['leg/select'] = array(
    'title' => t('Choose an existing leg'),
    'page callback' => 'drupal_get_form',
    'access arguments'

=> array('create leg content'),     
    'page arguments' => array('mymodule_leg_select_form'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 1,
); 

$items['leg/add'] = array(
    'title' => t('Create a new leg'),
    'page callback' => 'drupal_get_form',
    'access arguments' => array('create leg content'),     
    'page arguments' => array('leg_node_form'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
); 
return $items;

But I have this error when I go to that menu path.
I have no idea what I should do.

Node form is not rendered correctly as you can see in the screen shot.
I have two fields - field_from and field_to. They are not rendered in the form.
The menu path "leg/select" which is default local task does work and correctly render my custom form.
The problem only is to integrate node add form in the second tab.

How can I fix this error ?

AttachmentSize
leg-node-form.jpg197.25 KB

Comments

Can we see rest of code?

khaled.zaidan's picture

Hi cithukyaw,
It's kinda difficult to figure out what's going on with just the posted code. Would it be possible to post the whole module?
Also, do all these errors go away if you disable this module?