Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Anonymous (not verified) on
For example, if a user creates an image node, it would say "you have created an image ". I would really like to remove the title for those images - what would be the best way to do that without hacking core?
Comments
using form hooks
Hi
No, absolutely not, you must never hack the core.
You may look at some form submit hooks to invoke after node form submission, where you can pass the customize message.
-Imran
=-=
you can investigate the stringoverrides.module
Hi guys, thanks for your
Hi guys, thanks for your insightful comments.
(1) Could the node form submit message thing be accomplished with rules (and would that override the default one?)?
(2) For string override module, I'm trying to find that message with the exact placeholder though not 100% sure where its kept.. I need to use the exact string + placeholders to change the string, correct?
Ohh I found it: @type %title
Ohh I found it:
@type %title has been deleted.
@type %title has been
@type %title has been deleted.
This worked perfectly for me. Thanks!
=-=
hacking core files to make this change isn't the best way forward. You will be relegated to having to hack core again and again with each update.
Maybe you can find the
Maybe you can find the solution here, it deals with overriding the node drupal set mesage :
Overwriting node has been createdupdated drupal set messages
Hope it helps.
Benoit
there's a module for that
the above article describes 2 options to achive this scope:
+ one involves the String Overrides module - https://drupal.org/project/stringoverrides
+ the second helps you write your own custom module
but luckily, there is already a better / complete solutions:
+ Custom Submit Messages - https://drupal.org/project/csm
refer to the modules page for more details on what features it provides
and why it is a better / more general solution
Drupal Developer @Dropsolid
You can solve this using hook
You can solve this using hook_form_alter().
http://www.phponwebsites.com/
THIS!
This is the best answer I have seen anywhere so far, its so simple, works great, and I've learned a new hook :-)
THANK YOU!
/chris
// To hide message
this not hide the original node updating and creating new node..I THINK those messages created after this hook is execute
Able to overwrite core message on entity edit/create event.
It is possible to alter or overwrite the success or failure message in a hook_entity_insert, hook_entity_update or at form submit handler level.
just use the following code.
Note: This will work in D8.5+ version
Drupal 10 solution
See #3115394-14: Allow modules to alter messages during Node save.