public function TranslatableInterface::addTranslation

public TranslatableInterface::addTranslation($langcode, array $values = array())

Adds a new translation to the translatable object.

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.

File

core/lib/Drupal/Core/TypedData/TranslatableInterface.php, line 98

Class

TranslatableInterface
Interface for translatable data.

Namespace

Drupal\Core\TypedData

Code

public function addTranslation($langcode, array $values = array());

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!TypedData!TranslatableInterface.php/function/TranslatableInterface::addTranslation/8.1.x