You are here

public function FieldTargetBase::getLangcode in Feeds 8.3

Gets the configured language.

Return value

string The configured language.

Overrides TranslatableTargetInterface::getLangcode

2 calls to FieldTargetBase::getLangcode()
EntityReference::createEntity in src/Feeds/Target/EntityReference.php
Creates a new entity with the given label and saves it.
FieldTargetBase::getEntityTarget in src/Plugin/Type/Target/FieldTargetBase.php
Get entity, or entity translation to set the map.

File

src/Plugin/Type/Target/FieldTargetBase.php, line 411

Class

FieldTargetBase
Helper class for field mappers.

Namespace

Drupal\feeds\Plugin\Type\Target

Code

public function getLangcode() {
  if (!empty($this->configuration['language'])) {
    return $this->configuration['language'];
  }

  // Get the language from the processor, if the processor has one.
  $processor = $this->feedType
    ->getProcessor();
  if ($processor instanceof EntityProcessorInterface) {
    return $processor
      ->entityLanguage();
  }

  // Return default language.
  return $this
    ->getLanguageManager()
    ->getDefaultLanguage()
    ->getId();
}