By claudiu.cristea on
Change record status:
Draft (View all draft change records)
Project:
Issue links:
Description:
Entity benefits from a new method, ::getLanguageCode(), that allows to retrieve the language code of the entity. Until now, the language code was obtained from the entity ::language() method.
Before (not recommended)
Until now we had to get first the language object from the entity and then obtain its ID (language code). This way of getting the language code is still working but it's not recommended.:
$langcode = $entity->language()->getId();
After (recommended)
$langcode = $entity->getLanguageCode();
Impacts:
Module developers
Themers
Comments
This is not merged to core
This is not merged to core and its not working, so this change record should be removed -
$langcode = $entity->getLanguageCode();
@claudiu.cristea could you
@claudiu.cristea could you please check that comment and clarify what happened here?
http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes
Yup, confirmed, this appears
Yup, confirmed, this appears to have not been merged into core.
draft change record
This is a draft change record, still pending the related issue.
#2303877: Remove cached languages from ContentEntityBase
Thanks @joseph.olstad! You're
Thanks @joseph.olstad! You're right, but as we can see here (and same happened to me once), this isn't very clear.
People find these Change Records and think they're live. I guess that should be indicated more clearly?
http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes