Problem adding button to custom content type form
Ok found the problem with implementing the hook, I copy pasted the code from some post and it was passing $form variable by value. The correct signature of the alter_form should be

modulename_form_alter(&amp;$form, &amp;$form_state, $form_id)