示例#1
0
 private function applyRequestToBlock(RequestInterface $request, PageBlock $block)
 {
     $this->setBlockParameters($block, $request);
     $this->setBlockSortOrder($block, $request);
     $this->setBlockStatus($block, $request);
     $blockType = $this->blockTypeContainer->getType($block->getType());
     $blockType->validate($block, $request);
 }
示例#2
0
 private function createBlockFromRequest(RequestInterface $request, Page $page) : PageBlock
 {
     $requestAttributes = $request['attributes'];
     $blockType = $this->blockTypeContainer->getType($requestAttributes['type']);
     $pageBlock = $blockType->newBlock($page, $requestAttributes['location'], $requestAttributes['sort_order'], PageStatusValue::get($requestAttributes['status']));
     foreach ($requestAttributes['parameters'] as $parameter => $value) {
         $pageBlock[$parameter] = $value;
     }
     $blockType->validate($pageBlock, $request);
     return $pageBlock;
 }