ContentTranslationHandler::getSourceLangcode

public ContentTranslationHandler::getSourceLangcode(FormStateInterface $form_state)

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

File

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

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;
}
doc_Drupal
2016-10-29 08:58:15
Comments
Leave a Comment

Please login to continue.