public function testGetDescription_notFound() { $termLookup = $this->getTermLookup(); $fallbackChain = $this->getLanguageFallbackChain('ar'); $labelDescriptionLookup = new LanguageFallbackLabelDescriptionLookup($termLookup, $fallbackChain); $this->assertNull($labelDescriptionLookup->getDescription(new ItemId('Q116'))); }
/** * Formats a row for display. * * @param PropertyId $propertyId * * @return string */ protected function formatRow($propertyId) { $title = $this->titleLookup->getTitleForId($propertyId); if (!$title->exists()) { return $this->entityIdFormatter->formatEntityId($propertyId); } $labelTerm = $this->labelDescriptionLookup->getLabel($propertyId); $row = Html::rawElement('a', array('title' => $title ? $title->getPrefixedText() : $propertyId->getSerialization(), 'href' => $title ? $title->getLocalURL() : ''), Html::rawElement('span', array('class' => 'wb-itemlink'), Html::element('span', array('class' => 'wb-itemlink-label', 'lang' => $labelTerm ? $labelTerm->getLanguageCode() : ''), $labelTerm ? $labelTerm->getText() : '') . ($labelTerm ? ' ' : '') . Html::element('span', array('class' => 'wb-itemlink-id'), '(' . $propertyId->getSerialization() . ')'))); return $row; }
/** * @param EntityId $entityId * * @return null|Term */ private function getDescriptionDisplayTerm(EntityId $entityId) { return $this->labelDescriptionLookup->getDescription($entityId); }