You are here

public function ContentTranslationHandler::getSourceLangcode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::getSourceLangcode()

Retrieves the source language for the translation being created.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

string The source language code.

Overrides ContentTranslationHandlerInterface::getSourceLangcode

4 calls to ContentTranslationHandler::getSourceLangcode()
ContentTranslationHandler::entityFormAlter in core/modules/content_translation/src/ContentTranslationHandler.php
Performs the needed alterations to the entity form.
ContentTranslationHandler::entityFormEntityBuild in core/modules/content_translation/src/ContentTranslationHandler.php
Entity builder method.
ProfileTranslationHandler::entityFormSave in core/modules/user/src/ProfileTranslationHandler.php
Form submission handler for ProfileTranslationHandler::entityFormAlter().
TermTranslationHandler::entityFormSave in core/modules/taxonomy/src/TermTranslationHandler.php
Form submission handler for TermTranslationHandler::entityFormAlter().

File

core/modules/content_translation/src/ContentTranslationHandler.php, line 261
Contains \Drupal\content_translation\ContentTranslationHandler.

Class

ContentTranslationHandler
Base class for content translation handlers.

Namespace

Drupal\content_translation

Code

public function getSourceLangcode(FormStateInterface $form_state) {
  if ($source = $form_state
    ->get([
    'content_translation',
    'source',
  ])) {
    return $source
      ->getId();
  }
  return FALSE;
}