Example #1
0
 /**
  * Creates and Returns a property-array for content-type Block.
  *
  * @param BlockMetadata $property
  * @param PropertyValue $propertyValue
  * @param $format
  *
  * @return array
  */
 protected function getBlockPropertyData(BlockMetadata $property, $propertyValue, $format)
 {
     $children = [];
     $blockDataList = $this->contentExportManager->export($property->getType(), $propertyValue);
     foreach ($blockDataList as $blockData) {
         $blockType = $blockData['type'];
         $block = $this->getPropertiesContentData($property->getComponentByName($blockType)->getChildren(), $blockData, $format);
         $block['type'] = $this->createProperty('type', $blockType, $this->contentExportManager->getOptions($property->getType(), $format), $property->getType() . '_type');
         $children[] = $block;
     }
     return $this->createProperty($property->getName(), null, $this->contentExportManager->getOptions($property->getType(), $format), $property->getType(), $children);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function export($properties, $format = null)
 {
     $container = new ExcerptValueContainer($properties);
     $data = [];
     foreach ($this->getExcerptStructure()->getProperties() as $property) {
         if ($container->__isset($property->getName())) {
             $property->setValue($container->__get($property->getName()));
             $contentType = $this->contentTypeManager->get($property->getContentTypeName());
             if ($this->contentExportManager->hasExport($property->getContentTypeName(), $format)) {
                 $options = $this->contentExportManager->getOptions($property->getContentTypeName(), $format);
                 $data[$property->getName()] = ['name' => $property->getName(), 'value' => $contentType->exportData($property->getValue()), 'type' => $property->getContentTypeName(), 'options' => $options];
             }
         }
     }
     return $data;
 }