You are here

protected function ContentEntityBase::updateFieldLangcodes in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::updateFieldLangcodes()
  2. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::updateFieldLangcodes()

Updates language for already instantiated fields.

1 call to ContentEntityBase::updateFieldLangcodes()
ContentEntityBase::onChange in core/lib/Drupal/Core/Entity/ContentEntityBase.php
Reacts to changes to a field.

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 770

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

protected function updateFieldLangcodes($langcode) {
  foreach ($this->fields as $name => $items) {
    if (!empty($items[LanguageInterface::LANGCODE_DEFAULT])) {
      $items[LanguageInterface::LANGCODE_DEFAULT]
        ->setLangcode($langcode);
    }
  }
}