Skip to content
Advertisement

Altering Title on Drupal Node Delete Confirmation Form

When you attempt to delete a node in Drupal, you’re taken to a confirmation page whose title is…

Are you sure you want to delete {title of node}?

I’m attempting to alter the title of this page and have had no luck at all. I’ve tried the following at theme and module levels to no avail:

hook_form_node_delete_confirm_alter(...)
template_preprocess_html(&$vars)
template_preprocess_page(&$vars)
template_preprocess_region(&$vars)
template_confirm_form(&$vars)

I was additionally unable to find anything useful in devel themer.

Drupal 7, please.

Advertisement

Answer

This works like a charm for me:

function mymodule_form_node_delete_confirm_alter(&$form, &$form_state, $form_id) {
  drupal_set_title('New Title');
}

Make sure you clear Drupal’s caches after you’ve implemented the hook or it might not be picked up.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement