Пример #1
0
 public function createComponentFileBrowser()
 {
     $control = $this->fileBrowserControlFactory->invoke();
     $control->setBrowserMode((bool) $this->browserMode);
     if ($this->type) {
         if ($this->type == 'page') {
             $control->setRoot($this->pageRepository->find($this->page)->dir);
         } elseif ($this->type == 'route') {
             $control->setRoot($this->routeRepository->find($this->route)->dir);
         }
     }
     return $control;
 }
Пример #2
0
 /**
  * @return ExtendedPageEntity
  * @throws BadRequestException
  */
 public function getPageEntity()
 {
     if (!$this->_pageEntity) {
         if (!($this->_pageEntity = $this->pageRepository->find($this->key))) {
             throw new BadRequestException();
         }
         if (!($this->_pageEntity = $this->getEntityManager()->getRepository($this->_pageEntity->class)->findOneBy(array('page' => $this->_pageEntity->id)))) {
             throw new BadRequestException();
         }
         if ($this->websiteManager->defaultLanguage !== $this->languageEntity->alias) {
             $this->_pageEntity->page->locale = $this->_pageEntity->page->mainRoute->locale = $this->languageEntity;
         }
     }
     return $this->_pageEntity;
 }