Beispiel #1
0
 /**
  * @param ContainerInterface $container
  * @param $requestedName
  * @param array $options
  * @return Layout
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $layout = new Layout($container->get(LayoutUpdaterInterface::class), $container->get(BlockPoolInterface::class));
     /** @var ModuleOptions $moduleOptions */
     $moduleOptions = $container->get(ModuleOptions::class);
     foreach ($moduleOptions->getGenerators() as $name => $specs) {
         $generator = $container->get($specs['class']);
         $layout->attachGenerator($name, $generator, $specs['priority']);
     }
     return $layout;
 }
Beispiel #2
0
 public function testInjectBlocks()
 {
     $layout = new Layout($this->updaterMock, $this->blockPool);
     $layout->attachGenerator('blocks', $this->blocksGenerator);
     $layoutModel = new ViewModel();
     $layout->setRoot($layoutModel);
     $layout->load();
     $this->assertEquals('new/layout', $layoutModel->getTemplate());
     $this->assertCount(3, $layoutModel->getChildren());
     $this->assertCount(1, $layout->getBlock('widget.1')->getChildren());
 }