You are here

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

Same name and namespace in other branches
  1. 8.4 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::addTranslation()
  2. 8 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser::addTranslation()
  3. 8.2 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 699

Class

TokenAuthUser
The decorated user class with token information.

Namespace

Drupal\simple_oauth\Authentication

Code

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