本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: addBlock
public function addBlock($bt, $a, $data)
{
return parent::addBlock($bt, $a, $data);
}