You are here

public function OverridesSectionStorage::getSourceLanguage in Layout Builder Symmetric Translations 8

Gets the source language of the translation if any.

Return value

\Drupal\Core\Language\LanguageInterface|null The translation source language if the current layout is for a translation otherwise NULL.

Overrides TranslatableSectionStorageInterface::getSourceLanguage

File

src/Plugin/SectionStorage/OverridesSectionStorage.php, line 105

Class

OverridesSectionStorage

Namespace

Drupal\layout_builder_st\Plugin\SectionStorage

Code

public function getSourceLanguage() {
  if (!$this
    ->isDefaultTranslation()) {

    /** @var \Drupal\Core\Entity\TranslatableInterface $entity */
    $entity = $this
      ->getEntity();
    return $entity
      ->getUntranslated()
      ->language();
  }
  return NULL;
}