In ECK entity from submit:
drupal_set_message(t("Entity {$entity->id} - @entity_label has been saved", array("@entity_label" => entity_label($form['#entity_type'], $entity)) ));
The message 'Entity 3 - Test member has been saved' is just really odd and unlike any other part of drupal. To be honest, I don't want the users of the website to see what entity id it is. Can you make it the same as any other entity and just have the @type !name has been saved. 'Member Profile Test member has been saved.' (Member profile being the entity here).
If that works for you, I'm happy to make a patch and send it though to you.
Comments
Comment #1
jamesharv commentedI thought I'd have a crack at writing a patch for this. To me it made more sense for the default message to reference the entity bundle, rather than the entity type (Eg. "Basic Page", rather than "Node"), and to allow the message to be altered via a drupal_alter() hook.
I've attached a patch against the current 7.x-2.x branch, as well as another patch against the current stable release (7.x-2.0-rc2) for anyone who wants to use this with the stable version of the module.
Comment #2
nonsimilar commentedAgreed: the original message is not even translatable because it's dynamic... I'll try the patch.
EDIT: patch works and I definitely prefer these messages.
Comment #3
damienmckennaWas the patch checked against 7.x-2.x-dev?
Comment #4
damienmckennaDoh, never mind, comment #1 says it was.
Comment #5
timmarwick commentedFor some reason this patch would not apply to latest 7-2.x, so I've re-rolled it for the latest dev version.
Note: this patch version also cleanly applies to 7.x-2.0-rc4.
Finally, I think this is a good solution for the standard ECK save messages (which are quite weird), and am wondering if this will be rolled into the main branch anytime soon?
Comment #6
pcambraHere's an updated version of #5, no need to send the type of the entity when we're sending already the entity itself.
Attached are a patch for the latest HEAD and also one for rc2 because of legacy.
Comment #7
weri commentedThats exactly how it should work. Thanks for the patch!
I tested and reviewed the patch 'entity-save-message-2006710-6.patch'. Everything looks good and it's ready to commit.
Comment #28
djdevinStill applies to 2.x and works fine.
Comment #29
djdevinActually fixed in #2415703: Entity save message is not modifiable