0

Sometimes when I am editing I may accidentally edit the same page in different tabs, or I might forget whether I have updated the page earlier or not. I use a Save and Edit button when saving and when I save I want to know when I last saved based on the notice in at the top of the page, where I normally see a message like the following.

screenshot

There is some sample code for a module that changes the message handling - https://atendesigngroup.com/blog/drupal-7-drupal-8-customize-or-remove-node-creation-message. How could I change it just to add a timestamp to the message?

2 Answers 2

1

The problem is that at the point where these hooks are being used you have SESSION and FORM available and what you're asking for is a NODE attribute.

This can be done, simply loading the given NODE under the right conditions... but one should recognize doing this does have broader impact as these hooks are called fairly frequently.

How node_load is done is accomplished very differently in D7 and D8, not sure which one you're using from the question. Lots of answers out there how to render fields from a node. One more tip; your D7 install should have entity - the future proof method of getting node values is probably entity_load as nodes are entities in late D7 and all of D8...

0

I found a solution from the related questions Simple way to change messages after node creation.

The solution uses Rules to accomplish it, but the OP mentions a Custom Submit Messages which didn't work for Drupal 7 at the time of the question but has been updated since them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.