function ContentTranslationHandler::getSourceLangcode

Same name and namespace in other branches
  1. 11.x core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::getSourceLangcode()
  2. 10 core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::getSourceLangcode()
  3. 8.9.x core/modules/content_translation/src/ContentTranslationHandler.php \Drupal\content_translation\ContentTranslationHandler::getSourceLangcode()

File

core/modules/content_translation/src/ContentTranslationHandler.php, line 307

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.