Use case:Add a theme suggestion based on the language of a message.
For now, there is no way to get the language of the Message (outside of the class)

Issue fork message-3157375

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuneBL created an issue. See original summary.

DuneBL’s picture

Issue summary: View changes
DuneBL’s picture

tcrawford’s picture

Status: Active » Reviewed & tested by the community

I tested this patch and it works. The feature will help resolve a language translation issue on the message_notify module #2965975 and therefore it would be good to move this forward.

pfrenssen’s picture

pfrenssen’s picture

Tests are failing on Drupal 10 because they are using the stable theme which has been removed. This is being handled in #3314596: Tests fail on D10 due to missing theme.

jhedstrom’s picture

Status: Reviewed & tested by the community » Needs review

Should we make a new major version since an interface change is technically breaking? I'm not sure if anybody has, or would, implement this interface outside of the module though...

pfrenssen’s picture

We can not rule out that there might be a project that has their own implementation of the Message entity, but this should indeed be rare, and chances are high that IF this is the case, then they would be extending the current class rather than building their own entire class from scratch.

I saw that core even allows adding methods to interfaces in minor releases. In core only interfaces tagged with @api will not be touched in minor releases (ref. https://www.drupal.org/about/core/policies/core-change-policies/bc-polic...). This @api tag is not commonly used in contrib though.

I personally think we're fine adding this in a minor release and don't expect this to impact our users, but we cannot rule out that there is _someone_ out there who might be affected.

  • jhedstrom committed 29d5fb2 on 8.x-1.x authored by pfrenssen
    Issue #3157375 by pfrenssen, DuneBL, jhedstrom: Add a getLanguage()...
jhedstrom’s picture

Status: Needs review » Fixed

That makes sense to me! Thanks all!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.