コード例 #1
0
ファイル: block.php プロジェクト: nveid/concrete5
	public function export($node, $exportType = 'full') {
		if (!$this->isAliasOfMasterCollection()) {
			$blockNode = $node->addChild('block');
			$blockNode->addAttribute('type', $this->getBlockTypeHandle());
			$blockNode->addAttribute('name', $this->getBlockName());
			if ($this->getBlockFilename() != '') {
				$blockNode->addAttribute('custom-template', $this->getBlockFilename());
			}
			if (is_object($this->c) && $this->c->isMasterCollection()) {
				$mcBlockID = Loader::helper('validation/identifier')->getString(8);
				ContentExporter::addMasterCollectionBlockID($this, $mcBlockID);
				$blockNode->addAttribute('mc-block-id', $mcBlockID);
			}			

			if ($exportType == 'composer') {
				$db = Loader::db();
				$cbFilename = $db->GetOne('select ccFilename from ComposerContentLayout where bID = ?', array($this->getBlockID()));
				if ($cbFilename) {
					$blockNode->addAttribute("composer-template", $cbFilename);
				}
			}
			
			if ($exportType == 'full') {
				$bc = $this->getInstance();
				$bc->export($blockNode);
			}
		} else {
			$blockNode = $node->addChild('block');
			$blockNode->addAttribute('mc-block-id', ContentExporter::getMasterCollectionTemporaryBlockID($this));			
		}
	}