You are here

public function BackgroundImage::getLanguageCode in Background Image 2.0.x

Same name and namespace in other branches
  1. 8 src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getLanguageCode()
  2. 2.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getLanguageCode()

Returns the currently set langcode for the entity.

@todo Remove if https://www.drupal.org/project/drupal/issues/2303877 lands.

Return value

string The currently set langcode.

1 call to BackgroundImage::getLanguageCode()
BackgroundImage::getTargetEntity in src/Entity/BackgroundImage.php
Retrieves the target entity, if the type is supported and exists.

File

src/Entity/BackgroundImage.php, line 504

Class

BackgroundImage
Defines the Background Image entity.

Namespace

Drupal\background_image\Entity

Code

public function getLanguageCode() {
  if ($this->activeLangcode !== LanguageInterface::LANGCODE_DEFAULT) {
    return $this->activeLangcode;
  }
  return $this->defaultLangcode;
}