当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::addBlock方法代码示例

本文整理汇总了PHP中Concrete\Core\Page\Page::addBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::addBlock方法的具体用法?PHP Page::addBlock怎么用?PHP Page::addBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Concrete\Core\Page\Page的用法示例。


在下文中一共展示了Page::addBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: publish

 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $records = $value->getRecords();
     $inspector = \Core::make('import/value_inspector');
     if (count($records) == 1) {
         $data = array();
         foreach ($records[0]->getData() as $key => $value) {
             $result = $inspector->inspect($value);
             $data[$key] = $result->getReplacedValue();
         }
         $b = $page->addBlock($bt, $area->getName(), $data);
     } elseif (count($records) > 1) {
         foreach ($records as $record) {
             if (strcasecmp($record->getTable(), $bt->getController()->getBlockTypeDatabaseTable()) == 0) {
                 // This is the data record.
                 $data = array();
                 foreach ($record->getData() as $key => $value) {
                     $result = $inspector->inspect($value);
                     $data[$key] = $result->getReplacedValue();
                 }
                 $b = $page->addBlock($bt, $area->getName(), $data);
             }
         }
         // Now we import the OTHER records.
         foreach ($records as $record) {
             if (strcasecmp($record->getTable(), $bt->getController()->getBlockTypeDatabaseTable()) != 0) {
                 $aar = new BlockRecord($record->getTable());
                 $aar->bID = $b->getBlockID();
                 foreach ($record->getData() as $key => $value) {
                     $result = $inspector->inspect($value);
                     $aar->{$key} = $result->getReplacedValue();
                 }
                 $aar->Save();
             }
         }
     } else {
         $b = $page->addBlock($bt, $area->getName(), array());
     }
     return $b;
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:40,代码来源:StandardPublisher.php

示例2: publish

 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $data = array();
     $data['slID'] = array();
     $records = $value->getRecords();
     foreach ($records as $record) {
         $value = $record->getData();
         $value = $value['service'];
         // because it comes out as an array
         $socialLink = Link::getByServiceHandle($value);
         if (is_object($socialLink)) {
             $data['slID'][] = $socialLink->getID();
         }
     }
     $b = $page->addBlock($bt, $area->getName(), $data);
     return $b;
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:17,代码来源:SocialLinksPublisher.php

示例3: publish

 public function publish(Batch $batch, BlockType $bt, Page $page, Area $area, BlockValue $value)
 {
     $routine = new PublishPageContentRoutine();
     $routine->setBatch($batch);
     /* @var $value AreaLayoutBlockValue */
     $layout = $value->getAreaLayout();
     $publisher = $layout->getPublisher();
     $layoutObject = $publisher->publish($layout);
     $columns = $layout->getColumns();
     $i = 0;
     $layoutBlock = $page->addBlock($bt, $area->getName(), array('arLayoutID' => $layoutObject->getAreaLayoutID()));
     foreach ($layoutObject->getAreaLayoutColumns() as $columnObject) {
         $column = $columns[$i];
         foreach ($column->getBlocks() as $block) {
             $subValue = $block->getBlockValue();
             $publisher = $subValue->getPublisher();
             $subarea = new Area();
             $subAreaName = $area->getName() . SubArea::AREA_SUB_DELIMITER . $columnObject->getAreaLayoutColumnDisplayID();
             $subarea->setName($subAreaName);
             /*
              * @var $publisher BlockPublisherInterface
              */
             $subBlockType = $routine->getTargetItem('block_type', $block->getType());
             if (is_object($subBlockType)) {
                 $b = $publisher->publish($batch, $subBlockType, $page, $subarea, $subValue);
                 $styleSet = $block->getStyleSet();
                 if (is_object($styleSet)) {
                     $styleSetPublisher = $styleSet->getPublisher();
                     $publishedStyleSet = $styleSetPublisher->publish();
                     $b->setCustomStyleSet($publishedStyleSet);
                 }
                 if ($block->getCustomTemplate()) {
                     $b->setCustomTemplate($block->getCustomTemplate());
                 }
             }
         }
         ++$i;
     }
     return $layoutBlock;
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:40,代码来源:AreaLayoutPublisher.php

示例4: addBlock

 public function addBlock($bt, $a, $data)
 {
     return parent::addBlock($bt, $a, $data);
 }
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:4,代码来源:__IDE_SYMBOLS__.php


注:本文中的Concrete\Core\Page\Page::addBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。