/**
  * Generates HTML of the term box, to be injected into the entity page.
  *
  * @param EntityId $entityId
  * @param int $revisionId
  *
  * @throws InvalidArgumentException
  * @return string HTML
  */
 public function renderTermBox(EntityId $entityId, $revisionId)
 {
     $languages = array_merge(array($this->uiLanguage->getCode()), $this->getExtraUserLanguages());
     try {
         // we may want to cache this...
         $entityRev = $this->entityRevisionLookup->getEntityRevision($entityId, $revisionId);
     } catch (StorageException $ex) {
         // Could not load entity revision, $revisionId might be a deleted revision
         return '';
     }
     if (!$entityRev) {
         // Could not load entity revision, entity might not exist for $entityId.
         return '';
     }
     $entity = $entityRev->getEntity();
     $entityTermsView = new EntityTermsView($this->templateFactory, null, $this->languageNameLookup, $this->uiLanguage->getCode());
     // FIXME: assumes all entities have a fingerprint
     $html = $entityTermsView->getEntityTermsForLanguageListView($entity->getFingerprint(), $languages, $this->targetPage);
     return $html;
 }