本文整理汇总了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;
}