Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
79 lines (70 sloc) 2.85 KB
<?php
/**
* Created by PhpStorm.
* User: vincent.foulon
* Date: 08/09/2017
* Time: 13:38
*/
namespace VFou\CmsBundle\Configuration;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Routing\RouterInterface;
class CmsConfiguration extends AbstractConfiguration
{
public function getConfiguration()
{
return [
"cms_disablecache" => [
"name"=>$this->translator->trans("config.cache.name",[],"admin"),
"hint"=>$this->translator->trans("config.cache.hint",[],"admin"),
"default" => false
],
"cms_redirectexpiration" => [
"name"=>$this->translator->trans("config.redirectexpiration.name",[],"admin"),
"hint"=>$this->translator->trans("config.redirectexpiration.hint",[],"admin"),
"default" => "30 days"
],
"cms_disableredirect" => [
"name"=>$this->translator->trans("config.redirect.name",[],"admin"),
"hint"=>$this->translator->trans("config.redirect.hint",[],"admin"),
"default" => false
]
];
}
public function getForm(FormBuilderInterface $fb, $configuration) {
return $fb->add("cms_disablecache", CheckboxType::class, [
"label" => $this->getConfiguration()["cms_disablecache"]["name"],
"attr" => ["title"=>$this->getConfiguration()["cms_disablecache"]["hint"]],
"data" => $configuration["cms_disablecache"],
"required" => false
])->add("cms_redirectexpiration", TextType::class, [
"label" => $this->getConfiguration()["cms_redirectexpiration"]["name"],
"attr" => ["title"=>$this->getConfiguration()["cms_redirectexpiration"]["hint"]],
"data" => $configuration["cms_redirectexpiration"],
"required" => false
])->add("cms_disableredirect", CheckboxType::class, [
"label" => $this->getConfiguration()["cms_disableredirect"]["name"],
"attr" => ["title"=>$this->getConfiguration()["cms_disableredirect"]["hint"]],
"data" => $configuration["cms_disableredirect"],
"required" => false
]);
}
/**
* @param RouterInterface $router
* @return array
*/
public function addToolbar(RouterInterface $router){
return [
"toolbar.cms.templates" => "template_index",
"toolbar.cms.frontend_editing" => "frontend_editing"
];
}
public function registerTemplate()
{
return [
"template.cms.main" => "@VFouCmsBundle/Resources/views/Page/base.html.twig",
"template.cms.sitemap" => "@VFouCmsBundle/Resources/views/Type/sitemap.html.twig"
];
}
}
You can’t perform that action at this time.