/** * Builds the form * * @see FormTypeExtensionInterface::buildForm() */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('pageName', null, array('label' => 'pages_controller_label_page_name')); $builder->add('template', 'choice', array('choices' => ChoiceValues::getTemplates($this->activeTheme, $this->themes), 'label' => 'pages_controller_label_template')); $builder->add('isHome', 'checkbox', array('label' => 'pages_controller_label_home_page', 'attr' => array('title' => 'pages_controller_home_page_explanation'))); $builder->add('isPublished', 'checkbox', array('label' => 'pages_controller_label_published')); }
/** * Builds the form * * @see FormTypeExtensionInterface::buildForm() */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('idPage', 'hidden', array('label' => 'pages_controller_label_permalink')); $builder->add('idLanguage', 'choice', array('choices' => ChoiceValues::getLanguages($this->languageRepository))); $builder->add('permalink', 'textarea', array('label' => 'pages_controller_label_permalink', 'attr' => array('rows' => '3'))); $builder->add('title', 'textarea', array('label' => 'pages_controller_label_meta_title', 'attr' => array('title' => 'pages_controller_meta_title_explanation', 'rows' => '3'))); $builder->add('description', 'textarea', array('label' => 'pages_controller_label_meta_description', 'attr' => array('title' => 'pages_controller_meta_description_explanation', 'rows' => '3'))); $builder->add('keywords', 'textarea', array('label' => 'pages_controller_label_meta_keywords', 'attr' => array('title' => 'pages_controller_meta_keywords_explanation', 'rows' => '2'))); $builder->add('sitemapChangeFreq', 'choice', array('choices' => array('' => '-', 'always' => 'always', 'hourly' => 'hourly', 'daily' => 'daily', 'weekly' => 'weekly', 'monthly' => 'monthly', 'yearly' => 'yearly', 'never' => 'never'), 'label' => 'pages_controller_label_change frequency')); $builder->add('sitemapPriority', 'choice', array('choices' => array('0.0' => '0.0', '0.1' => '0.1', '0.2' => '0.2', '0.3' => '0.3', '0.4' => '0.4', '0.5' => '0.5', '0.6' => '0.6', '0.7' => '0.7', '0.8' => '0.8', '0.9' => '0.9', '1.0' => '1.0'), 'data' => '0.5', 'label' => 'pages_controller_label_priority')); }
public function showAction(Request $request) { $this->kernel = $this->container->get('kernel'); $pageTree = $this->container->get('red_kite_cms.page_tree'); $isSecure = null !== $this->get('security.context')->getToken() ? true : false; $this->factoryRepository = $this->container->get('red_kite_cms.factory_repository'); $this->languageRepository = $this->factoryRepository->createRepository('Language'); $this->pageRepository = $this->factoryRepository->createRepository('Page'); $this->seoRepository = $this->factoryRepository->createRepository('Seo'); $bootstrapVersion = $this->container->get('red_kite_cms.active_theme')->getThemeBootstrapVersion(); $params = array('template' => 'RedKiteCmsBundle:Cms:Welcome/welcome.html.twig', 'templateStylesheets' => null, 'templateJavascripts' => null, 'available_blocks' => null, 'internal_stylesheets' => null, 'internal_javascripts' => null, 'skin_path' => $this->getSkin(), 'is_secure' => $isSecure, 'page' => 0, 'language' => 0, 'available_languages' => $this->container->getParameter('red_kite_cms.available_languages'), 'frontController' => $this->getFrontcontroller($request)); if (null !== $pageTree) { $pageId = 0; $languageId = 0; $pageName = ''; $languageName = ''; $page = $pageTree->getPage(); $language = $pageTree->getLanguage(); if (null !== $page) { $pageId = $page->getId(); $pageName = $page->getPageName(); } if (null !== $language) { $languageId = $language->getId(); $languageName = $language->getLanguageName(); } $blocksAddedMenu = $this->container->get('red_kite_cms.blocks_adder_menu'); $template = $this->findTemplate($pageTree); $params = array_merge($params, array('metatitle' => $pageTree->getMetaTitle(), 'metadescription' => $pageTree->getMetaDescription(), 'metakeywords' => $pageTree->getMetaKeywords(), 'internal_stylesheets' => $pageTree->getInternalStylesheets(), 'internal_javascripts' => $pageTree->getInternalJavascripts(), 'template' => $template, 'pages' => ChoiceValues::getPages($this->pageRepository), 'languages' => ChoiceValues::getLanguages($this->languageRepository), 'permalinks' => ChoiceValues::getPermalinks($this->seoRepository, $languageId), 'page' => $pageId, 'language' => $languageId, 'page_name' => $pageName, 'language_name' => $languageName, 'base_template' => $this->container->getParameter('red_kite_labs_theme_engine.base_template'), 'templateStylesheets' => $pageTree->getExternalStylesheets(), 'templateJavascripts' => $this->fixAssets($pageTree->getExternalJavascripts()), 'available_blocks' => $blocksAddedMenu->build($this->container->get('red_kite_cms.block_manager_factory')->getBlocks()))); } else { $configuration = $this->container->get('red_kite_cms.configuration'); $cmsLanguage = $configuration->read('language'); $message = $this->container->get('translator')->trans('cms_controller_page_not_exists_for_given_language', array('%page%' => $request->get('page'), '%language%' => $request->get('_locale')), 'RedKiteCmsBundle', $cmsLanguage); $this->container->get('session')->getFlashBag()->add('notice', $message); } $response = $this->render(sprintf('RedKiteCmsBundle:Bootstrap:%s/Template/Cms/template.html.twig', $bootstrapVersion), $params); return $this->dispatchEvents($request, $response); }
protected function getPages() { return ChoiceValues::getPages($this->createRepository('Page'), false); }
protected function buildJSonHeader(Request $request, $message, $language = null) { $languages = $languagesList = ChoiceValues::getLanguages($this->createLanguageRepository()); unset($languagesList['none']); $values = array(); $values[] = array("key" => "message", "value" => $message); $values[] = array("key" => "languages", "value" => $this->renderView('RedKiteCmsBundle:Languages:languages_list.html.twig', array('languages' => $languagesList, 'active_language' => $request->get('language')))); $values[] = array("key" => "languages_menu", "value" => $this->renderView('RedKiteCmsBundle:Partials:_dropdown_menu.html.twig', array('id' => 'al_languages_navigator', 'type' => 'al_language_item', 'value' => null !== $language ? $language->getId() : 0, 'text' => $request->get('language'), 'items' => $languages))); $response = new Response(json_encode($values)); $response->headers->set('Content-Type', 'application/json'); return $response; }