I am trying to add a cancel button to a custom content type form (typename/type/add). I have looked around and there seems to be two main ways of doing this:
- Creating a template file with the name page–node–add–typename.tpl
- Implementing the
hook_form_alter
either in the theme template.tpl.php or in a custom module.
then adding code like
$form['actions']['cancel'] = array( '#type' => 'submit', '#value' => t('Cancel'), '#access' => TRUE, '#weight' => 55, '#submit' => array('cancel_button_form_cancel', 'node_form_submit_build_node'), '#limit_validation_errors' => array(), );
In the first case, after rendering the form with drupal_render($form)
the button is added but only the form is rendered. Main menu and other blocks are not rendered.
However in the second case the button never appears. Even though something like drupal_set_title('Title')
does change the title.
Any solution to either issue would be most welcome.
Edit The first part of this question is now a separate one here.