示例#1
0
 /**
  * @param $blockId
  * @param BlockXml $blockXML
  * @return BlockXml
  */
 public function saveBlockConfig($blockId, \Fraym\Block\BlockXml $blockXML)
 {
     $blockConfig = $this->request->getGPAsObject();
     $customProperties = new \Fraym\Block\BlockXmlDom();
     if (isset($blockConfig->config)) {
         $element = $customProperties->createElement('dynamicTemplateConfig');
         $element->appendChild($customProperties->createCDATASection(serialize($blockConfig->config)));
         $customProperties->appendChild($element);
     }
     $element = $customProperties->createElement('dynamicTemplate');
     $element->nodeValue = $blockConfig->dynamicTemplate;
     $customProperties->appendChild($element);
     $blockXML->setCustomProperty($customProperties);
     return $blockXML;
 }
示例#2
0
文件: Image.php 项目: fraym/core
 /**
  * @param $blockId
  * @param \Fraym\Block\BlockXml $blockXML
  * @return \Fraym\Block\BlockXml
  */
 public function saveBlockConfig($blockId, \Fraym\Block\BlockXml $blockXML)
 {
     $data = $this->request->post('image');
     $data['auto_size'] = isset($data['auto_size']) && $data['auto_size'] == '1' ? true : false;
     $customProperties = new \Fraym\Block\BlockXmlDom();
     foreach ($data as $prop => $val) {
         if (!empty($val)) {
             $element = $customProperties->createElement('image_' . $prop);
             $element->nodeValue = $val;
             $customProperties->appendChild($element);
         }
     }
     $blockXML->setCustomProperty($customProperties);
     return $blockXML;
 }
示例#3
0
 /**
  * @param $blockId
  * @param BlockXml $blockXML
  * @return BlockXml
  */
 public function saveBlockConfig($blockId, \Fraym\Block\BlockXml $blockXML)
 {
     $blockConfig = $this->request->getGPAsObject();
     $customProperties = new \Fraym\Block\BlockXmlDom();
     foreach ($blockConfig->html as $localeId => $content) {
         $element = $customProperties->createElement('html');
         $domAttribute = $customProperties->createAttribute('locale');
         $domAttribute->value = $localeId;
         $element->appendChild($domAttribute);
         $element->appendChild($customProperties->createCDATASection($content));
         $customProperties->appendChild($element);
     }
     $blockXML->setCustomProperty($customProperties);
     return $blockXML;
 }
示例#4
0
 /**
  * @param $blockId
  * @param \Fraym\Block\BlockXml $blockXML
  * @return \Fraym\Block\BlockXml
  */
 public function saveBlockConfig($blockId, \Fraym\Block\BlockXml $blockXML)
 {
     $blockConfig = $this->request->getGPAsObject();
     $customProperties = new \Fraym\Block\BlockXmlDom();
     $element = $customProperties->createElement('mailformOptions');
     $element->appendChild($customProperties->createCDATASection(json_encode($blockConfig->config)));
     $customProperties->appendChild($element);
     $blockXML->setCustomProperty($customProperties);
     return $blockXML;
 }
示例#5
0
 /**
  * @param $blockId
  * @param \Fraym\Block\BlockXml $blockXML
  * @return \Fraym\Block\BlockXml
  */
 public function saveBlockConfig($blockId, \Fraym\Block\BlockXml $blockXML)
 {
     $blockConfig = $this->request->getGPAsObject();
     $customProperties = new \Fraym\Block\BlockXmlDom();
     $element = $customProperties->createElement('view');
     $element->appendChild($customProperties->createCDATASection($blockConfig->newsView));
     $customProperties->appendChild($element);
     $listPage = isset($blockConfig->listPage) ? intval($blockConfig->listPage) : 1;
     if ($blockConfig->newsView === 'detail' || $blockConfig->newsView === 'detail-category' || $blockConfig->newsView === 'detail-tag') {
         $element = $customProperties->createElement('listPage', $listPage);
         $customProperties->appendChild($element);
     } elseif ($blockConfig->newsView === 'list-category' || $blockConfig->newsView === 'list-tag') {
         $element = $customProperties->createElement('listPage', $this->route->getCurrentMenuItem()->id);
         $customProperties->appendChild($element);
     } elseif ($blockConfig->newsView === 'list') {
         $element = $customProperties->createElement('limit');
         $element->nodeValue = $blockConfig->limit;
         $customProperties->appendChild($element);
         $forceShowOnDetail = property_exists($blockConfig, 'forceShowOnDetail') && $blockConfig->forceShowOnDetail == '1' ? 1 : 0;
         $element = $customProperties->createElement('forceShowOnDetail', $forceShowOnDetail);
         $customProperties->appendChild($element);
         if (isset($blockConfig->detailPage)) {
             $element = $customProperties->createElement('detailPage', intval($blockConfig->detailPage));
             $customProperties->appendChild($element);
         }
         $element = $customProperties->createElement('listItems');
         if (isset($blockConfig->newsListItems)) {
             $element->appendChild($customProperties->createCDATASection(implode(',', $blockConfig->newsListItems)));
         }
         $customProperties->appendChild($element);
         $element = $customProperties->createElement('newsListSort');
         $element->nodeValue = $blockConfig->newsListSort;
         $customProperties->appendChild($element);
     }
     $blockXML->setCustomProperty($customProperties);
     return $blockXML;
 }