简体   繁体   中英

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.

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.

I have a module for Drupal 8 that lets you set this in config from the node type edit form. https://www.drupal.org/project/node_form_overrides

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM