/** * Returns parameters for given property merged wit default parameters. * * @param PropertyInterface $property * * @return array */ public function getParamsFunction(PropertyInterface $property) { $typeParams = []; if ($this->contentTypeManager->has($property->getContentTypeName())) { $type = $this->getTypeFunction($property->getContentTypeName()); $typeParams = $type->getDefaultParams($property); } return $this->mergeRecursive($typeParams, $property->getParams()); }
private function getReferencedUuids(PropertyInterface $property) { $contentTypeName = $property->getContentTypeName(); $contentType = $this->contentTypeManager->get($contentTypeName); $referencedUuids = $contentType->getReferencedUuids($property); return $referencedUuids; }
/** * returns name of content type. * * @return string */ public function getContentTypeName() { return $this->property->getContentTypeName(); }
/** * write a property to node. */ private function writeProperty(PropertyInterface $property, PropertyInterface $blockProperty, $value, $index, NodeInterface $node, $userId, $webspaceKey, $languageCode, $segmentKey, $isImport = false) { // save sub property $contentType = $this->contentTypeManager->get($property->getContentTypeName()); $blockPropertyWrapper = new BlockPropertyWrapper($property, $blockProperty, $index); $blockPropertyWrapper->setValue($value); if ($isImport && $contentType instanceof ContentTypeExportInterface) { return $contentType->importData(new SuluNode($node), $blockPropertyWrapper, $value, $userId, $webspaceKey, $languageCode, $segmentKey); } $contentType->write(new SuluNode($node), $blockPropertyWrapper, $userId, $webspaceKey, $languageCode, $segmentKey); }
/** * Prepare document-property and import them. * * @param PropertyInterface $property * @param NodeInterface $node * @param string $value * @param string $webspaceKey * @param string $locale * @param string $format */ protected function importProperty(PropertyInterface $property, NodeInterface $node, StructureInterface $structure, $value, $webspaceKey, $locale, $format) { $contentType = $property->getContentTypeName(); if (!$this->contentImportManager->hasImport($contentType, $format)) { return; } $translateProperty = $this->legacyPropertyFactory->createTranslatedProperty($property, $locale, $structure); $this->contentImportManager->import($contentType, $node, $translateProperty, $value, null, $webspaceKey, $locale); }
/** * write a property to node. */ private function writeProperty(PropertyInterface $property, PropertyInterface $blockProperty, $index, NodeInterface $node, $userId, $webspaceKey, $languageCode, $segmentKey) { // save sub property $contentType = $this->contentTypeManager->get($property->getContentTypeName()); $blockPropertyWrapper = new BlockPropertyWrapper($property, $blockProperty, $index); // TODO find a better why for change Types (same hack is used in ContentMapper:save ) $contentType->remove($node, $blockPropertyWrapper, $webspaceKey, $languageCode, $segmentKey); $contentType->write($node, $blockPropertyWrapper, $userId, $webspaceKey, $languageCode, $segmentKey); }