Example #1
0
 /** @ORM\PostLoad */
 public function postLoadHandler(RouteEntity $route, LifecycleEventArgs $event)
 {
     $em = $event->getEntityManager();
     $route->setExtendedRouteCallback(function () use($em, $route) {
         return $em->getRepository($route->getClass())->findOneBy(array('route' => $route->id));
     });
 }
Example #2
0
 /**
  * @param Form $form
  */
 public function configure(Form $form)
 {
     $form->addGroup();
     $form->addText('name', 'Name');
     $form->addText('localUrl', 'URL');
     $form->addText('title', 'Title');
     $form->addText('keywords', 'Keywords');
     $form->addText('description', 'Description');
     $form->addManyToOne('author', 'Author');
     $form->addSelect('robots', 'Robots')->setItems(RouteEntity::getRobotsValues(), FALSE);
     $form->addSelect('changefreq', 'Change frequency')->setItems(RouteEntity::getChangefreqValues(), FALSE)->setPrompt('-------');
     $form->addSelect('priority', 'Priority')->setItems(RouteEntity::getPriorityValues(), FALSE)->setPrompt('-------');
     // layout
     $form->setCurrentGroup($form->addGroup());
     $form->addCheckbox('copyLayoutFromParent', 'Layout from parent');
     $form['copyLayoutFromParent']->addCondition($form::EQUAL, FALSE)->toggle('group-layout_' . $form->data->id);
     $form->setCurrentGroup($form->getForm()->addGroup()->setOption('id', 'group-layout_' . $form->data->id));
     $form->addManyToOne('layout', 'Layout');
     $form->setCurrentGroup($form->addGroup());
     $form->addCheckbox('copyLayoutToChildren', 'Share layout with children');
     $form['copyLayoutToChildren']->addCondition($form::EQUAL, FALSE)->toggle('group-layout2_' . $form->data->id);
     $form->setCurrentGroup($form->getForm()->addGroup()->setOption('id', 'group-layout2_' . $form->data->id));
     $form->addManyToOne('childrenLayout', 'Share new layout');
     // cache
     $form->setCurrentGroup($form->addGroup());
     $form->addCheckbox('copyCacheModeFromParent', 'Cache mode from parent');
     $form['copyCacheModeFromParent']->addCondition($form::EQUAL, FALSE)->toggle('group-cache_' . $form->data->id);
     $form->setCurrentGroup($form->getForm()->addGroup()->setOption('id', 'group-cache_' . $form->data->id));
     $form->addSelect('cacheMode', 'Cache strategy')->setItems(\CmsModule\Content\Entities\RouteEntity::getCacheModes(), FALSE)->setPrompt('off');
     $form->setCurrentGroup($form->addGroup());
     $form->addFileEntityInput('photo', 'Photo');
     $form->addTextArea('notation', 'Notation');
     $form->addTextArea('text', 'Text');
     $form->addGroup('Dates');
     $form->addDateTime('created', 'Created')->setDisabled(TRUE);
     $form->addDateTime('updated', 'Updated')->setDisabled(TRUE);
     $form->addDateTime('released', 'Released')->addRule($form::FILLED);
     $form->addDateTime('expired', 'Expired');
     $form->addGroup('Tags');
     $form->addContentTags('tags');
     $aliases = $form->addMany('aliases', function (\Venne\Forms\Container $container) use($form) {
         $container->setCurrentGroup($form->addGroup('URL alias'));
         $container->addText('aliasUrl', 'Url')->setRequired();
         $container->addText('aliasLang', 'Language alias');
         $container->addText('aliasDomain', 'Domain url');
         $container->addSubmit('remove', 'Remove alias')->addRemoveOnClick();
     });
     $aliases->addSubmit('add', 'Add alias')->addCreateOnClick();
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }
Example #3
0
 /**
  * @param Form $form
  */
 protected function configure(Form $form)
 {
     $form->addGroup('Global meta informations');
     $form->addText('name', 'Website name')->addRule($form::FILLED);
     $form->addText('title', 'Title')->setOption('description', '(%n - name, %s - separator, %t - local title)');
     $form->addText('titleSeparator', 'Title separator');
     $form->addText('keywords', 'Keywords');
     $form->addText('description', 'Description');
     $form->addText('author', 'Author');
     $form->addGroup('System');
     $form->addTextWithSelect('routePrefix', 'Route prefix');
     $form->addTextWithSelect('oneWayRoutePrefix', 'One way route prefix');
     $form->addSelect('theme', 'Module width theme', $this->getModules())->setPrompt('off');
     $form->addSelect('cacheMode', 'Cache strategy')->setItems(\CmsModule\Content\Entities\RouteEntity::getCacheModes(), FALSE)->setPrompt('off');
     $form['cacheMode']->addCondition($form::EQUAL, 'time')->toggle('cacheValue');
     $form->addGroup()->setOption('id', 'cacheValue');
     $form->addSelect('cacheValue', 'Minutes')->setItems(array(1, 2, 5, 10, 15, 20, 30, 40, 50, 60, 90, 120), FALSE);
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }
Example #4
0
 /**
  * @param RouteEntity $routeEntity
  */
 public function setRoute(RouteEntity $routeEntity)
 {
     $this->routeEntity = $routeEntity;
     $this->pageEntity = $routeEntity->getPage();
     $this->layoutEntity = $routeEntity->getLayout();
 }
Example #5
0
 /**
  * Modify request by page
  *
  * @param \Nette\Application\Request $request
  * @param RouteEntity $route
  * @param $parameters
  * @param string $domain
  * @return \Nette\Application\Request
  */
 protected function modifyConstructRequest(Request $request, RouteEntity $route, $parameters, $domain)
 {
     $request->setPresenterName(self::DEFAULT_MODULE . ':' . self::DEFAULT_PRESENTER);
     $request->setParameters(array('module' => self::DEFAULT_MODULE, 'presenter' => self::DEFAULT_PRESENTER, 'action' => self::DEFAULT_ACTION, 'lang' => count($this->languages) > 1 ? isset($parameters['lang']) ? $parameters['lang'] : ($route->page->language ? $route->page->language->alias : $this->defaultLanguage) : NULL, 'slug' => $route->getUrl(), 'domain' => $route->domain ? $route->domain->domain : '') + $parameters);
     return $request;
 }