You are here

public function TokenAuthUser::addTranslation in Simple OAuth (OAuth2) & OpenID Connect 8

Same name and namespace in other branches
  1. 8.4 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::addTranslation()
  2. 8.2 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::addTranslation()
  3. 8.3 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::addTranslation()
  4. 5.x src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::addTranslation()

Adds a new translation to the translatable object.

To create a translation of an entity prefilled with the original data:

$entity
  ->addTranslation($langcode, $entity
  ->toArray());

Parameters

string $langcode: The language code identifying the translation.

array $values: (optional) An array of initial values to be assigned to the translatable fields. Defaults to none.

Return value

$this

Throws

\InvalidArgumentException If an invalid or existing translation language is specified.

Overrides TranslatableInterface::addTranslation

File

src/Authentication/TokenAuthUser.php, line 654

Class

TokenAuthUser
Class TokenAuthUser.

Namespace

Drupal\simple_oauth\Authentication

Code

public function addTranslation($langcode, array $values = array()) {
  return $this->subject
    ->addTranslation($langcode, $values);
}