本文整理汇总了PHP中SMW\DataValueFactory::newPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DataValueFactory::newPropertyValue方法的具体用法?PHP DataValueFactory::newPropertyValue怎么用?PHP DataValueFactory::newPropertyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMW\DataValueFactory
的用法示例。
在下文中一共展示了DataValueFactory::newPropertyValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addDataValuesToSubobject
protected function addDataValuesToSubobject(ParserParameterProcessor $parameters)
{
$subject = $this->parserData->getSemanticData()->getSubject();
// Named subobjects containing a "." in the first five characters are reserved to be
// used by extensions only in order to separate them from user land and avoid them
// accidentally to refer to the same named ID
// (i.e. different access restrictions etc.)
if (strpos(mb_substr($parameters->getFirst(), 0, 5), '.') !== false) {
return $this->addErrorWithMsg($subject, wfMessage('smw-subobject-parser-invalid-naming-scheme', $parameters->getFirst())->escaped());
}
$this->subobject->setEmptyContainerForId($this->createSubobjectId($parameters));
foreach ($this->transformParametersToArray($parameters) as $property => $values) {
if ($property === self::PARAM_SORTKEY) {
$property = DIProperty::TYPE_SORTKEY;
}
if ($property === self::PARAM_CATEGORY) {
$property = DIProperty::TYPE_CATEGORY;
}
foreach ($values as $value) {
$dataValue = $this->dataValueFactory->newPropertyValue($property, $value, false, $subject);
$this->subobject->addDataValue($dataValue);
}
}
return true;
}
示例2: addDataValuesToSubobject
protected function addDataValuesToSubobject(ArrayFormatter $parameters)
{
$subject = $this->parserData->getSemanticData()->getSubject();
$this->subobject->setEmptyContainerForId($this->createSubobjectId($parameters));
foreach ($this->transformParametersToArray($parameters) as $property => $values) {
if ($property === self::PARAM_SORTKEY) {
$property = DIProperty::TYPE_SORTKEY;
}
foreach ($values as $value) {
$dataValue = $this->dataValueFactory->newPropertyValue($property, $value, false, $subject);
$this->subobject->addDataValue($dataValue);
}
}
}
示例3: 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->getSemanticData()->getSubject();
// Add properties to the semantic container
foreach ($properties as $property) {
$dataValue = $this->dataValueFactory->newPropertyValue($property, $value, $valueCaption, $subject);
if ($this->isEnabledNamespace && $this->isAnnotation) {
$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()) {
$result .= $dataValue->getErrorText();
}
return $result;
}
示例4: 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();
// Add properties to the semantic container
foreach ($properties as $property) {
$dataValue = $this->dataValueFactory->newPropertyValue($property, $value, $valueCaption, $subject);
if ($this->isEnabledNamespace && $this->isAnnotation) {
$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;
}