src/Phlexible/Bundle/ElementtypeBundle/ElementtypeService.php
public function createElementtype(
        $type,
        $uniqueId,
        $name,
        $icon,
        ElementtypeStructure $elementtypeStructure = null,
        array $mappings = null,
        $user,
        $flush = true)
    {
        if (!$icon) {
            $icons = [
                Elementtype::TYPE_FULL => 'artikel_list.gif',
                Elementtype::TYPE_STRUCTURE => 'nav_haupt.gif',
                Elementtype::TYPE_LAYOUTAREA => '_fallback.gif',
                Elementtype::TYPE_LAYOUTCONTAINER => '_fallback.gif',
                Elementtype::TYPE_PART => 'teaser_hellblau_list.gif',
                Elementtype::TYPE_REFERENCE => '_fallback.gif',
            ];

            $icon = $icons[$type];
        }

        $elementtype = new Elementtype();
        $elementtype
            ->setUniqueId($uniqueId)
            ->setType($type)
            ->setTitle('de', $name)
            ->setTitle('en', $name)
            ->setIcon($icon)
            ->setRevision(1)
            ->setStructure($elementtypeStructure)
            ->setMappings($mappings)
            ->setCreateUser($user)
            ->setCreatedAt(new \DateTime())
            ->setModifyUser($elementtype->getCreateUser())
            ->setModifiedAt($elementtype->getCreatedAt());

        $this->elementtypeManager->updateElementtype($elementtype);

        return $elementtype;
    }
public function createElementtype(
        $type,
        $uniqueId,
        $name,
        $icon,
        ElementtypeStructure $elementtypeStructure = null,
        array $mappings = null,
        $user,
        $flush = true)
    {
        if (!$icon) {
            $icons = [
                Elementtype::TYPE_FULL => 'artikel_list.gif',
                Elementtype::TYPE_STRUCTURE => 'nav_haupt.gif',
                Elementtype::TYPE_LAYOUTAREA => '_fallback.gif',
                Elementtype::TYPE_LAYOUTCONTAINER => '_fallback.gif',
                Elementtype::TYPE_PART => 'teaser_hellblau_list.gif',
                Elementtype::TYPE_REFERENCE => '_fallback.gif',
            ];

            $icon = $icons[$type];
        }

        $elementtype = new Elementtype();
        $elementtype
            ->setUniqueId($uniqueId)
            ->setType($type)
            ->setTitle('de', $name)
            ->setTitle('en', $name)
            ->setIcon($icon)
            ->setRevision(1)
            ->setStructure($elementtypeStructure)
            ->setMappings($mappings)
            ->setCreateUser($user)
            ->setCreatedAt(new \DateTime())
            ->setModifyUser($elementtype->getCreateUser())
            ->setModifiedAt($elementtype->getCreatedAt());

        $this->elementtypeManager->updateElementtype($elementtype);

        return $elementtype;
    }
public function createElementtype ( $ type , $ uniqueId , $ name , $ icon , ElementtypeStructure $ elementtypeStructure = null , array $ mappings = null , $ user , $ flush = true ) { if ( ! $ icon ) { $ icons = [ Elementtype :: TYPE_FULL => 'artikel_list.gif' , Elementtype :: TYPE_STRUCTURE => 'nav_haupt.gif' , Elementtype :: TYPE_LAYOUTAREA => '_fallback.gif' , Elementtype :: TYPE_LAYOUTCONTAINER => '_fallback.gif' , Elementtype :: TYPE_PART => 'teaser_hellblau_list.gif' , Elementtype :: TYPE_REFERENCE => '_fallback.gif' , ] ; $ icon = $ icons [ $ type ] ; } $ elementtype = new Elementtype ( ) ; $ elementtype -> setUniqueId ( $ uniqueId ) -> setType ( $ type ) -> setTitle ( 'de' , $ name ) -> setTitle ( 'en' , $ name ) -> setIcon ( $ icon ) -> setRevision ( 1 ) -> setStructure ( $ elementtypeStructure ) -> setMappings ( $ mappings ) -> setCreateUser ( $ user ) -> setCreatedAt ( new \ DateTime ( ) ) -> setModifyUser ( $ elementtype -> getCreateUser ( ) ) -> setModifiedAt ( $ elementtype -> getCreatedAt ( ) ) ; $ this -> elementtypeManager -> updateElementtype ( $ elementtype ) ; return $ elementtype ; }
Create a new empty Element Type.

@param string               $type
@param string               $uniqueId
@param string               $name
@param string               $icon
@param ElementtypeStructure $elementtypeStructure
@param array                $mappings
@param string               $user
@param bool                 $flush

@return Elementtype
Create a new empty Element Type .