private function getResultsForProperty($dataItem) { $content = $this->getResultContent($dataItem); if (!$this->isMultiValueWithParameter('index') && !$this->isMultiValueWithParameter('lang')) { return $content; } // Print one component of a multi-valued string. // // Known limitation: the printrequest still is of type _rec, so if // printers check for this then they will not recognize that it returns // some more concrete type. if ($this->printRequest->isMode(PrintRequest::PRINT_CHAIN)) { $propertyValue = $this->printRequest->getData()->getLastPropertyChainValue(); } else { $propertyValue = $this->printRequest->getData(); } $index = $this->printRequest->getParameter('index'); $lang = $this->printRequest->getParameter('lang'); $newcontent = array(); // Replace content with specific content from a Container/MultiValue foreach ($content as $diContainer) { /* AbstractMultiValue */ $multiValue = DataValueFactory::getInstance()->newDataValueByItem($diContainer, $propertyValue->getDataItem()); if ($multiValue instanceof MonolingualTextValue && $lang !== false && ($textValue = $multiValue->getTextValueByLanguage($lang)) !== null) { // Return the text representation without a language reference // (tag) since the value has been filtered hence only matches // that language $newcontent[] = $textValue->getDataItem(); // Set the index so ResultArray::getNextDataValue can // find the correct PropertyDataItem (_TEXT;_LCODE) position // to match the DI $this->printRequest->setParameter('index', 1); } elseif ($lang === false && $index !== false && ($dataItemByRecord = $multiValue->getDataItemByIndex($index)) !== null) { $newcontent[] = $dataItemByRecord; } } $content = $newcontent; unset($newcontent); return $content; }