- Issue created by @gcb
We are using licenses for a site that has paid memberships. The language on the site uses "membership" instead of "license". We overrode the entity definition label so all the built-in messaging and UX would be consistent. However, the word "License" is hard-coded into some user facing elements.
Yes, we could use translation to overcome this issue, but that's much more complicated than just using the entity type label by default.
Add a hook like this to a custom module:
/**
* Implements hook_entity_type_alter().
*/
function mymodule_entity_type_alter(array &$entity_types) {
$entity_types['commerce_license']->set('label', t('Membership'));
}
Buy a membership with a user. Then add another membership to your cart so you get a system message about already having a License. It will show "License" not "membership"
Where "license" is hardcoded into messages, just grab the entity type label instead.
I only caught a couple of messages that appear in our implementation, so there are a few more instances of messages that need this change applied.
UX feedback becomes more dynamic based on the entity type definition.
none.
none.
Active
3.0
Code