hasExport() public method

Checks the content-type if this has an export.
public hasExport ( $contentTypeName, $format ) : boolean
$contentTypeName
$format
return boolean
Example #1
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;
 }
Example #2
0
 /**
  * Returns the Content as a flat array.
  *
  * @param PropertyMetadata[] $properties
  * @param $propertyValues
  * @param $format
  *
  * @return array
  */
 protected function getPropertiesContentData($properties, $propertyValues, $format)
 {
     $contentData = [];
     foreach ($properties as $property) {
         if ($this->contentExportManager->hasExport($property->getType(), $format)) {
             if (!isset($propertyValues[$property->getName()])) {
                 continue;
             }
             $propertyValue = $propertyValues[$property->getName()];
             if ($property instanceof BlockMetadata) {
                 $data = $this->getBlockPropertyData($property, $propertyValue, $format);
             } else {
                 $data = $this->getPropertyData($property, $propertyValue, $format);
             }
             $contentData[$property->getName()] = $data;
         }
     }
     return $contentData;
 }