コード例 #1
0
ファイル: BlockFactory.php プロジェクト: ramunasd/platform
 /**
  * Builds views for all blocks starting with and including the given root block
  *
  * @param string $rootId
  *
  * @return BlockView The root block view
  */
 protected function buildBlockViews($rootId)
 {
     /** @var BlockView[] $views */
     $views = [];
     // build the root view
     $rootView = $this->buildBlockView($rootId);
     $views[$rootId] = $rootView;
     // build child views
     $iterator = $this->rawLayout->getHierarchyIterator($rootId);
     foreach ($iterator as $id) {
         $parentView = $views[$iterator->getParent()];
         // build child view
         $view = $this->buildBlockView($id, $parentView);
         $parentView->children[$id] = $view;
         $views[$id] = $view;
     }
     $viewsCollection = new ArrayCollection($views);
     foreach ($views as $view) {
         $view->blocks = $viewsCollection;
     }
     // finish the root view
     $this->finishBlockView($rootView, $rootId);
     // finish child views
     foreach ($iterator as $id) {
         $this->finishBlockView($views[$id], $id);
     }
     return $rootView;
 }
コード例 #2
0
ファイル: RawLayoutTest.php プロジェクト: ramunasd/platform
 /**
  * @dataProvider             emptyStringDataProvider
  *
  * @expectedException \Oro\Component\Layout\Exception\InvalidArgumentException
  * @expectedExceptionMessage The item id must not be empty.
  */
 public function testGetHierarchyIteratorWithEmptyId($id)
 {
     $this->rawLayout->getHierarchyIterator($id);
 }