Drupal 7 - Hide delete button on all content types

1.2k views Asked by At

I would like to Remove delete button on all content types in admin panel using small custom code.Please help.

1

There are 1 answers

1
TheodorosPloumis On

You have to create a custom module and use hook_form_alter. This module must run after all other modules that alter the forms. Example:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  dpm($form); // Use this to find the $form_id using Devel module if you like
  if ($form_id == "MY_FORM_ID")  {
   $form['actions']['delete']['#access'] = FALSE;
  }
}

For a complete set of options see at Specify $form elements to be excluded from display?