コード例 #1
0
 protected function addDataValuesToSubobject(ParserParameterProcessor $parserParameterProcessor)
 {
     // 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 having
     // them accidentally to refer to the same named ID
     // (i.e. different access restrictions etc.)
     if (strpos(mb_substr($parserParameterProcessor->getFirst(), 0, 5), '.') !== false) {
         return $this->parserData->addError(Message::encode(array('smw-subobject-parser-invalid-naming-scheme', $parserParameterProcessor->getFirst())));
     }
     list($parameters, $id) = $this->getParameters($parserParameterProcessor);
     $this->subobject->setEmptyContainerForId($id);
     $subject = $this->subobject->getSubject();
     foreach ($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 = DataValueFactory::getInstance()->newDataValueByText($property, $value, false, $subject);
             $this->subobject->addDataValue($dataValue);
         }
     }
     $this->doAugmentSortKeyForWhenDisplayTitleIsAccessible($this->subobject->getSemanticData());
     return true;
 }