concrete/src/Block/Block.php
public function export($node, $exportType = 'full')
    {
        if (!$this->isAliasOfMasterCollection() || (($this->c instanceof Page) && $this->c->isMasterCollection())) {
            // We have the OR up here so that master collections that you have duplicated from other
            // master collections export properly.
            $blockNode = $node->addChild('block');
            $blockNode->addAttribute('type', $this->getBlockTypeHandle());
            $blockNode->addAttribute('name', $this->getBlockName());
            if ($this->getBlockFilename() != '') {
                $blockNode->addAttribute('custom-template', $this->getBlockFilename());
            }
            if ($this->overrideBlockTypeContainerSettings()) {
                $blockNode->addAttribute('custom-container-settings', $this->enableBlockContainer() ? 1 : 0);
            }
            if (($this->c instanceof Page) && $this->c->isMasterCollection()) {
                $mcBlockID = Loader::helper('validation/identifier')->getString(8);
                ContentExporter::addMasterCollectionBlockID($this, $mcBlockID);
                $blockNode->addAttribute('mc-block-id', $mcBlockID);
            }

            if ($exportType == 'full') {
                $style = $this->getCustomStyle();
                if (is_object($style)) {
                    $set = $style->getStyleSet();
                    $set->export($blockNode);
                }
                if ($this->overrideBlockTypeCacheSettings()) {
                    $settings = $this->getBlockCacheSettingsObject();
                    $blockNode['cache-output'] = $settings->cacheBlockOutput();
                    $blockNode['cache-output-lifetime'] = $settings->getBlockOutputCacheLifetime();
                    $blockNode['cache-output-on-post'] = $settings->cacheBlockOutputOnPost();
                    $blockNode['cache-output-for-registered-users'] = $settings->cacheBlockOutputForRegisteredUsers();
                }
                $bc = $this->getController();
                $bc->export($blockNode);
            }
        } else {
            $blockNode = $node->addChild('block');
            $blockNode->addAttribute('mc-block-id', ContentExporter::getMasterCollectionTemporaryBlockID($this));
        }
    }
public function export($node, $exportType = 'full')
    {
        if (!$this->isAliasOfMasterCollection() || (($this->c instanceof Page) && $this->c->isMasterCollection())) {
            // We have the OR up here so that master collections that you have duplicated from other
            // master collections export properly.
            $blockNode = $node->addChild('block');
            $blockNode->addAttribute('type', $this->getBlockTypeHandle());
            $blockNode->addAttribute('name', $this->getBlockName());
            if ($this->getBlockFilename() != '') {
                $blockNode->addAttribute('custom-template', $this->getBlockFilename());
            }
            if ($this->overrideBlockTypeContainerSettings()) {
                $blockNode->addAttribute('custom-container-settings', $this->enableBlockContainer() ? 1 : 0);
            }
            if (($this->c instanceof Page) && $this->c->isMasterCollection()) {
                $mcBlockID = Loader::helper('validation/identifier')->getString(8);
                ContentExporter::addMasterCollectionBlockID($this, $mcBlockID);
                $blockNode->addAttribute('mc-block-id', $mcBlockID);
            }

            if ($exportType == 'full') {
                $style = $this->getCustomStyle();
                if (is_object($style)) {
                    $set = $style->getStyleSet();
                    $set->export($blockNode);
                }
                if ($this->overrideBlockTypeCacheSettings()) {
                    $settings = $this->getBlockCacheSettingsObject();
                    $blockNode['cache-output'] = $settings->cacheBlockOutput();
                    $blockNode['cache-output-lifetime'] = $settings->getBlockOutputCacheLifetime();
                    $blockNode['cache-output-on-post'] = $settings->cacheBlockOutputOnPost();
                    $blockNode['cache-output-for-registered-users'] = $settings->cacheBlockOutputForRegisteredUsers();
                }
                $bc = $this->getController();
                $bc->export($blockNode);
            }
        } else {
            $blockNode = $node->addChild('block');
            $blockNode->addAttribute('mc-block-id', ContentExporter::getMasterCollectionTemporaryBlockID($this));
        }
    }
public function export ( $ node , $ exportType = 'full' ) { if ( ! $ this -> isAliasOfMasterCollection ( ) || ( ( $ this -> c instanceof Page ) && $ this -> c -> isMasterCollection ( ) ) ) { // We have the OR up here so that master collections that you have duplicated from other // master collections export properly. $ blockNode = $ node -> addChild ( 'block' ) ; $ blockNode -> addAttribute ( 'type' , $ this -> getBlockTypeHandle ( ) ) ; $ blockNode -> addAttribute ( 'name' , $ this -> getBlockName ( ) ) ; if ( $ this -> getBlockFilename ( ) != '' ) { $ blockNode -> addAttribute ( 'custom-template' , $ this -> getBlockFilename ( ) ) ; } if ( $ this -> overrideBlockTypeContainerSettings ( ) ) { $ blockNode -> addAttribute ( 'custom-container-settings' , $ this -> enableBlockContainer ( ) ? 1 : 0 ) ; } if ( ( $ this -> c instanceof Page ) && $ this -> c -> isMasterCollection ( ) ) { $ mcBlockID = Loader :: helper ( 'validation/identifier' ) -> getString ( 8 ) ; ContentExporter :: addMasterCollectionBlockID ( $ this , $ mcBlockID ) ; $ blockNode -> addAttribute ( 'mc-block-id' , $ mcBlockID ) ; } if ( $ exportType == 'full' ) { $ style = $ this -> getCustomStyle ( ) ; if ( is_object ( $ style ) ) { $ set = $ style -> getStyleSet ( ) ; $ set -> export ( $ blockNode ) ; } if ( $ this -> overrideBlockTypeCacheSettings ( ) ) { $ settings = $ this -> getBlockCacheSettingsObject ( ) ; $ blockNode [ 'cache-output' ] = $ settings -> cacheBlockOutput ( ) ; $ blockNode [ 'cache-output-lifetime' ] = $ settings -> getBlockOutputCacheLifetime ( ) ; $ blockNode [ 'cache-output-on-post' ] = $ settings -> cacheBlockOutputOnPost ( ) ; $ blockNode [ 'cache-output-for-registered-users' ] = $ settings -> cacheBlockOutputForRegisteredUsers ( ) ; } $ bc = $ this -> getController ( ) ; $ bc -> export ( $ blockNode ) ; } } else { $ blockNode = $ node -> addChild ( 'block' ) ; $ blockNode -> addAttribute ( 'mc-block-id' , ContentExporter :: getMasterCollectionTemporaryBlockID ( $ this ) ) ; } }
Export the data associated to this block to an XML node.

@param \SimpleXMLElement $node the parent node where we'll append the XML node to
@param string $exportType set to 'full' to export cache and custom style settings too
Export the data associated to this block to an XML node .