/** * @param EntityId $entityId * @param string $propertyLabelOrId property label or ID (pXXX) * * @return string */ public function render(EntityId $entityId, $propertyLabelOrId) { try { $status = Status::newGood($this->statementTransclusionInteractor->render($entityId, $propertyLabelOrId)); } catch (PropertyLabelNotResolvedException $ex) { // @fixme use ExceptionLocalizer $status = $this->getStatusForException($propertyLabelOrId, $ex->getMessage()); } catch (EntityAccessLimitException $ex) { $status = $this->getStatusForException($propertyLabelOrId, $ex->getMessage()); } catch (InvalidArgumentException $ex) { $status = $this->getStatusForException($propertyLabelOrId, $ex->getMessage()); } if (!$status->isGood()) { $error = $status->getMessage()->inLanguage($this->language)->text(); return '<p class="error wikibase-error">' . $error . '</p>'; } return $status->getValue(); }
/** * Render the main Snaks belonging to a Statement (which is identified by a PropertyId * or the label of a Property). * * @since 0.5 * * @param string $entityId * @param string $propertyLabelOrId * @param int[]|null $acceptableRanks * * @return string */ public function formatPropertyValues($entityId, $propertyLabelOrId, array $acceptableRanks = null) { $entityId = $this->entityIdParser->parse($entityId); return $this->statementTransclusionInteractor->render($entityId, $propertyLabelOrId, $acceptableRanks); }