By rohitm on
I am trying to add another tab to the form while a new node is created using Create Content -> Page. I tried to use hook_form_alter but it adds the element to every other form in the system. Please help.
I am trying to add another tab to the form while a new node is created using Create Content -> Page. I tried to use hook_form_alter but it adds the element to every other form in the system. Please help.
Comments
You need to use $form_id ==
You need to use $form_id == [form_name] to only target the node creation form.
Contact me to contract me for D7 -> D10/11 migrations.
specify the form_id
hook_form_alter is the correct way, but you need to filter out by form_id. To define to form_id, you can simple print out the form_id in the hook_form_alter (use the devel module for this http://www.drupal.org/project/devel). See example below