示例#1
0
 public function createPhotosBlock()
 {
     if ($this->modulesManager->getModuleByIdentifier('argentique')->isEnabled()) {
         $photos = $this->builder->getPhotos();
         if (count($photos) > 0) {
             $block = ['template' => 'EtuCoreBundle:Main/index_blocks:photos.html.twig', 'context' => ['photos' => $photos]];
         }
     }
     return isset($block) ? $block : false;
 }
 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $modules = $this->modulesManager->getEnabledModules();
     if (is_array($modules)) {
         // Legacy hack for former doctrine ORM versions.
         $arrayobject = new \ArrayObject($modules);
         $modules = $arrayobject->getIterator();
     }
     // Boot modules
     /** @var $module Module */
     /** @var $modules \Iterator<Module> */
     foreach ($modules as $module) {
         if ($module->mustBoot()) {
             $module->setContainer($this->container);
             $module->setRouter($this->router);
             $module->onModuleBoot();
             $module->setEnabled(true);
         }
     }
     // Give an access from Twig
     $this->globalAccessorObject->set('modules', $this->modulesManager->getModules());
     // Access to env from Twig
     $this->globalAccessorObject->set('environment', $this->container->get('kernel')->getEnvironment());
 }