You are here

public function EntityTranslationDefaultHandler::addChild in Entity Translation 7

Overrides EntityTranslationHandlerInterface::addChild

See also

EntityTranslationHandlerInterface::addChild()

File

includes/translation.handler.inc, line 527
Default translation handler for the translation module.

Class

EntityTranslationDefaultHandler
Class implementing the default entity translation behaviours.

Code

public function addChild($entity_type, $entity) {
  if (!empty($this->factory)) {
    $handler = $this->factory
      ->getHandler($entity_type, $entity);
    $handler
      ->setActiveLanguage($this
      ->getActiveLanguage());
    $handler
      ->setSourceLanguage($this
      ->getSourceLanguage());

    // Avoid registering more than one child handler for each entity.
    $hid = $this->factory
      ->getHandlerId($entity_type, $entity);
    $this->children[$hid] = $handler;
  }
}