- 🇩🇰Denmark ressa Copenhagen
This is a great idea! It would be awesome to be able to alter the text at some point, and hope it's ok that I reopen the issue?
- 🇩🇰Denmark ressa Copenhagen
As a workaround until (or if) this lands, here's one method to tweak the message, from a MR for Simplenews:
use Drupal\Core\Entity\EntityForm; /** * Implements hook_form_alter(). * * Adds link to preview and send page above a newsletter. */ function simplenews_form_alter(&$form, &$form_state, $form_id) { $forms = [ 'node_simplenews_issue_form', 'node_simplenews_issue_edit_form', ]; $admin_or_send_rights = (\Drupal::currentUser()->hasPermission('administer newsletters') || \Drupal::currentUser()->hasPermission('send newsletter')); if (in_array($form_id, $forms) && $admin_or_send_rights) { // Adding custom callback to customize status message. $form['actions']['submit']['#submit'][] = '_post_node_save_callback'; } } /** * Custom callback to customize status message. */ function _post_node_save_callback($form, &$form_state) { $form_object = $form_state->getFormObject(); if ($form_object instanceof EntityForm) { $node = $form_object->getEntity(); $node_id = $node->id(); \Drupal::messenger()->addStatus(t('Preview or send it via the <a href="/node/' . $node_id .'/simplenews">Newsletter</a> tab, administer under <a href="/admin/content/simplenews">Newsletter issues</a>.')); } }
Based on the great blog post Customize/override the “node has been created/updated” status message on Drupal 9 by Barbara Bombachini → .
- Status changed to Closed: won't fix
12 days ago 10:29pm 25 March 2025 - 🇦🇺Australia acbramley
All core entities have something like this in their entity form's save method. Modules can override an entity types form class and subclass it to override the save method and add their own messages. I don't think customising messages is something that could/would ever be able to be supported in core.
For simple string changes, you can also use the
locale_custom_strings_en
setting, e.g you could map:
'@type %title has been updated.' => '@type %title has been updated, cool!