本文整理匯總了PHP中SMW\DataValueFactory::newDataValueByText方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataValueFactory::newDataValueByText方法的具體用法?PHP DataValueFactory::newDataValueByText怎麽用?PHP DataValueFactory::newDataValueByText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SMW\DataValueFactory
的用法示例。
在下文中一共展示了DataValueFactory::newDataValueByText方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addPropertyValue
/**
* Adds property values to the ParserOutput instance
*
* @since 1.9
*
* @param array $properties
*
* @return string
*/
protected function addPropertyValue(array $properties, $value, $valueCaption)
{
$subject = $this->parserData->getSubject();
if (($propertyLink = $this->getPropertyLink($subject, $properties, $value, $valueCaption)) !== '') {
return $propertyLink;
}
// Add properties to the semantic container
foreach ($properties as $property) {
$dataValue = $this->dataValueFactory->newDataValueByText($property, $value, $valueCaption, $subject);
if ($this->isEnabledNamespace && $this->isAnnotation && $this->parserData->canModifySemanticData()) {
$this->parserData->addDataValue($dataValue);
}
}
// Return the text representation
$result = $dataValue->getShortWikitext(true);
// If necessary add an error text
if ($this->settings->get('smwgInlineErrors') && $this->isEnabledNamespace && $this->isAnnotation && !$dataValue->isValid()) {
// Encode `:` to avoid a comment block and instead of the nowiki tag
// use : as placeholder
$result = str_replace(':', ':', $result) . $dataValue->getErrorText();
}
return $result;
}