src/Sulu/Component/Content/Compat/Structure/LegacyPropertyFactory.php
public function createProperty(ItemMetadata $property, StructureInterface $structure = null)
    {
        if ($property instanceof SectionMetadata) {
            return $this->createSectionProperty($property, $structure);
        }

        if ($property instanceof BlockMetadata) {
            return $this->createBlockProperty($property, $structure);
        }

        if (null === $property->getType()) {
            throw new \RuntimeException(sprintf(
                'Property name "%s" has no type.',
                $property->getName()
            ));
        }

        $parameters = $this->convertArrayToParameters($property->getParameters());
        $propertyBridge = new LegacyProperty(
            $property->getName(),
            [
                'title' => $property->getTitles(),
                'info_text' => $property->getDescriptions(),
                'placeholder' => $property->getPlaceholders(),
            ],
            $property->getType(),
            $property->isRequired(),
            $property->isLocalized(),
            $property->getMaxOccurs(),
            $property->getMinOccurs(),
            $parameters,
            [],
            $property->getColSpan()
        );

        foreach ($property->getTags() as $tag) {
            $propertyBridge->addTag(new PropertyTag($tag['name'], $tag['priority'], $tag['attributes']));
        }

        $propertyBridge->setStructure($structure);

        return $propertyBridge;
    }
public function createProperty(ItemMetadata $property, StructureInterface $structure = null)
    {
        if ($property instanceof SectionMetadata) {
            return $this->createSectionProperty($property, $structure);
        }

        if ($property instanceof BlockMetadata) {
            return $this->createBlockProperty($property, $structure);
        }

        if (null === $property->getType()) {
            throw new \RuntimeException(sprintf(
                'Property name "%s" has no type.',
                $property->getName()
            ));
        }

        $parameters = $this->convertArrayToParameters($property->getParameters());
        $propertyBridge = new LegacyProperty(
            $property->getName(),
            [
                'title' => $property->getTitles(),
                'info_text' => $property->getDescriptions(),
                'placeholder' => $property->getPlaceholders(),
            ],
            $property->getType(),
            $property->isRequired(),
            $property->isLocalized(),
            $property->getMaxOccurs(),
            $property->getMinOccurs(),
            $parameters,
            [],
            $property->getColSpan()
        );

        foreach ($property->getTags() as $tag) {
            $propertyBridge->addTag(new PropertyTag($tag['name'], $tag['priority'], $tag['attributes']));
        }

        $propertyBridge->setStructure($structure);

        return $propertyBridge;
    }
public function createProperty ( ItemMetadata $ property , StructureInterface $ structure = null ) { if ( $ property instanceof SectionMetadata ) { return $ this -> createSectionProperty ( $ property , $ structure ) ; } if ( $ property instanceof BlockMetadata ) { return $ this -> createBlockProperty ( $ property , $ structure ) ; } if ( null === $ property -> getType ( ) ) { throw new \ RuntimeException ( sprintf ( 'Property name "%s" has no type.' , $ property -> getName ( ) ) ) ; } $ parameters = $ this -> convertArrayToParameters ( $ property -> getParameters ( ) ) ; $ propertyBridge = new LegacyProperty ( $ property -> getName ( ) , [ 'title' => $ property -> getTitles ( ) , 'info_text' => $ property -> getDescriptions ( ) , 'placeholder' => $ property -> getPlaceholders ( ) , ] , $ property -> getType ( ) , $ property -> isRequired ( ) , $ property -> isLocalized ( ) , $ property -> getMaxOccurs ( ) , $ property -> getMinOccurs ( ) , $ parameters , [ ] , $ property -> getColSpan ( ) ) ; foreach ( $ property -> getTags ( ) as $ tag ) { $ propertyBridge -> addTag ( new PropertyTag ( $ tag [ 'name' ] , $ tag [ 'priority' ] , $ tag [ 'attributes' ] ) ) ; } $ propertyBridge -> setStructure ( $ structure ) ; return $ propertyBridge ; }
Create a new property.

@param Item $item

@return PropertyInterface $property
Create a new property .