diff --git a/Bundle/CoreBundle/Entity/View.php b/Bundle/CoreBundle/Entity/View.php index f54e9181e..1fd7453b4 100644 --- a/Bundle/CoreBundle/Entity/View.php +++ b/Bundle/CoreBundle/Entity/View.php @@ -19,10 +19,11 @@ * A victoire view is a visual representation with a widget map. * * @Gedmo\Tree(type="nested") - * @Gedmo\TranslationEntity(class="Victoire\Bundle\I18nBundle\Entity\ViewTranslation") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="type", type="string") - * @ORM\Entity(repositoryClass="Victoire\Bundle\CoreBundle\Repository\ViewRepository") + * @ORM\Entity( + * repositoryClass="Victoire\Bundle\CoreBundle\Repository\ViewRepository" + * ) * @ORM\Table("vic_view") * @ORM\HasLifecycleCallbacks */ diff --git a/Bundle/FormBundle/Form/Type/LinkType.php b/Bundle/FormBundle/Form/Type/LinkType.php index 5b368ffe1..ffdec16de 100644 --- a/Bundle/FormBundle/Form/Type/LinkType.php +++ b/Bundle/FormBundle/Form/Type/LinkType.php @@ -54,6 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'choices_as_values' => true, 'attr' => [ 'data-refreshOnChange' => 'true', + 'data-target' => $options['refresh-target'], ], ]) ->add('target', ChoiceType::class, [ @@ -175,6 +176,7 @@ public function configureOptions(OptionsResolver $resolver) 'translation_domain' => 'victoire', 'horizontal' => false, 'linkTypeChoices' => $this->getDefaultLinkTypeChoices(), + 'refresh-target' => null, ]); } diff --git a/Bundle/PageBundle/Helper/PageHelper.php b/Bundle/PageBundle/Helper/PageHelper.php index 94416c580..3e9622ee0 100644 --- a/Bundle/PageBundle/Helper/PageHelper.php +++ b/Bundle/PageBundle/Helper/PageHelper.php @@ -7,6 +7,7 @@ use Doctrine\ORM\ORMInvalidArgumentException; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -19,6 +20,7 @@ use Victoire\Bundle\BusinessPageBundle\Entity\BusinessTemplate; use Victoire\Bundle\BusinessPageBundle\Helper\BusinessPageHelper; use Victoire\Bundle\CoreBundle\Entity\EntityProxy; +use Victoire\Bundle\CoreBundle\Entity\Link; use Victoire\Bundle\CoreBundle\Entity\View; use Victoire\Bundle\CoreBundle\Event\PageRenderEvent; use Victoire\Bundle\CoreBundle\Helper\CurrentViewHelper; @@ -158,16 +160,19 @@ public function renderPageByUrl($url, $locale, $isAjax = false) $page = null; if ($viewReference = $this->viewReferenceRepository->getReferenceByUrl($url, $locale)) { $page = $this->findPageByReference($viewReference, $entity = $this->findEntityByReference($viewReference)); + $this->checkPageValidity($page, $entity, ['url' => $url, 'locale' => $locale]); + $page->setReference($viewReference); if ($page instanceof BasePage && $page->getSeo() && $page->getSeo()->getRedirectTo() + && $page->getSeo()->getRedirectTo()->getLinkType() != Link::TYPE_NONE && !$this->session->get('victoire.edit_mode', false)) { - $page = $page->getSeo()->getRedirectTo(); + $link = $page->getSeo()->getRedirectTo(); + + return new RedirectResponse($this->container->get('victoire_widget.twig.link_extension')->victoireLinkUrl($link->getParameters())); } - $this->checkPageValidity($page, $entity, ['url' => $url, 'locale' => $locale]); - $page->setReference($viewReference); return $this->renderPage($page, $isAjax); } else { @@ -281,7 +286,11 @@ public function findPageByReference($viewReference, $entity = null) if ($entity) { if ($page instanceof BusinessTemplate) { $page = $this->updatePageWithEntity($page, $entity); - } elseif ($page instanceof BusinessPage) { + } + if ($page instanceof BusinessPage) { + if ($page->getSeo()) { + $page->getSeo()->setCurrentLocale($viewReference->getLocale()); + } $this->pageSeoHelper->updateSeoByEntity($page, $entity); } } diff --git a/Bundle/SeoBundle/Controller/PageSeoController.php b/Bundle/SeoBundle/Controller/PageSeoController.php index 438a864b3..d35be65b9 100644 --- a/Bundle/SeoBundle/Controller/PageSeoController.php +++ b/Bundle/SeoBundle/Controller/PageSeoController.php @@ -65,8 +65,13 @@ public function settingsAction(View $page) ); $form->handleRequest($this->get('request')); + $novalidate = $this->get('request')->query->get('novalidate', false); - if ($form->isValid()) { + $template = 'VictoireSeoBundle:PageSeo:form.html.twig'; + if ($novalidate === false) { + $template = 'VictoireSeoBundle:PageSeo:settings.html.twig'; + } + if (false === $novalidate && $form->isValid()) { $em->persist($pageSeo); $page->setSeo($pageSeo); $em->persist($page); @@ -95,7 +100,7 @@ public function settingsAction(View $page) return new JsonResponse([ 'success' => !$form->isSubmitted(), 'html' => $this->container->get('templating')->render( - 'VictoireSeoBundle:PageSeo:settings.html.twig', + $template, [ 'page' => $page, 'form' => $form->createView(), diff --git a/Bundle/SeoBundle/Entity/PageSeo.php b/Bundle/SeoBundle/Entity/PageSeo.php index 951b59c1b..895fc690f 100644 --- a/Bundle/SeoBundle/Entity/PageSeo.php +++ b/Bundle/SeoBundle/Entity/PageSeo.php @@ -4,6 +4,8 @@ use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; +use Knp\DoctrineBehaviors\Model\Translatable\Translatable; +use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\Validator\Constraints as Assert; use Victoire\Bundle\CoreBundle\Entity\View; @@ -16,6 +18,7 @@ class PageSeo { use \Gedmo\Timestampable\Traits\TimestampableEntity; + use Translatable; /** * @var int @@ -259,624 +262,626 @@ class PageSeo /** * @var string * - * @ORM\ManyToOne(targetEntity="\Victoire\Bundle\PageBundle\Entity\Page", inversedBy="referers", cascade={"persist"}) + * @ORM\ManyToOne( + * targetEntity="\Victoire\Bundle\PageBundle\Entity\Page", + * inversedBy="referers", + * cascade={"persist"} + * ) * @ORM\JoinColumn(name="redirect_to", referencedColumnName="id", onDelete="SET NULL") */ protected $redirectTo; /** - * @Gedmo\Locale - * Used locale to override Translation listener`s locale - * this is not a mapped field of entity metadata, just a simple property - * and it is not necessary because globally locale can be set in listener - */ - protected $locale; - - /** - * contructor. - **/ - public function __construct() - { - $this->createdAt = $this->createdAt ? $this->createdAt : new \DateTime(); - $this->updatedAt = new \DateTime(); - } - - /** - * Get id. - * - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Set redirectTo. + * Set redirectTo w/ proxy. * * @param View $redirectTo * * @return PageSeo */ - public function setRedirectTo(View $redirectTo) + public function setRedirectTo(View $redirectTo, $locale = null) { - $this->redirectTo = $redirectTo; + $this->translate($locale, false)->setRedirectTo($redirectTo); + $this->mergeNewTranslations(); return $this; } /** - * Get redirectTo. + * Get redirectTo w/ proxy. * * @return string */ public function getRedirectTo() { - return $this->redirectTo; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRedirectTo'); } /** - * Set metaTitle. + * Set metaTitle w/ proxy. * * @param string $metaTitle * * @return PageSeo */ - public function setMetaTitle($metaTitle) + public function setMetaTitle($metaTitle, $locale = null) { - $this->metaTitle = $metaTitle; + $this->translate($locale, false)->setMetaTitle($metaTitle); + $this->mergeNewTranslations(); return $this; } /** - * Get metaTitle. + * Get metaTitle w/ proxy. * * @return string */ public function getMetaTitle() { - return $this->metaTitle; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaTitle'); } /** - * Set metaDescription. + * Set metaDescription w/ proxy. * * @param string $metaDescription * * @return PageSeo */ - public function setMetaDescription($metaDescription) + public function setMetaDescription($metaDescription, $locale = null) { - $this->metaDescription = $metaDescription; + $this->translate($locale, false)->setMetaDescription($metaDescription); + $this->mergeNewTranslations(); return $this; } /** - * Get metaDescription. + * Get metaDescription w/ proxy. * * @return string */ public function getMetaDescription() { - return $this->metaDescription; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaDescription'); } /** - * Set relAuthor. + * Set relAuthor w/ proxy. * * @param string $relAuthor * * @return PageSeo */ - public function setRelAuthor($relAuthor) + public function setRelAuthor($relAuthor, $locale = null) { - $this->relAuthor = $relAuthor; + $this->translate($locale, false)->setRelAuthor($relAuthor); + $this->mergeNewTranslations(); return $this; } /** - * Get relAuthor. + * Get relAuthor w/ proxy. * * @return string */ public function getRelAuthor() { - return $this->relAuthor; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRelAuthor'); } /** - * Set relPublisher. + * Set relPublisher w/ proxy. * * @param string $relPublisher * * @return PageSeo */ - public function setRelPublisher($relPublisher) + public function setRelPublisher($relPublisher, $locale = null) { - $this->relPublisher = $relPublisher; + $this->translate($locale, false)->setRelPublisher($relPublisher); + $this->mergeNewTranslations(); return $this; } /** - * Get relPublisher. + * Get relPublisher w/ proxy. * * @return string */ public function getRelPublisher() { - return $this->relPublisher; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRelPublisher'); } /** - * Set ogTitle. + * Set ogTitle w/ proxy. * * @param string $ogTitle * * @return PageSeo */ - public function setOgTitle($ogTitle) + public function setOgTitle($ogTitle, $locale = null) { - $this->ogTitle = $ogTitle; + $this->translate($locale, false)->setOgTitle($ogTitle); + $this->mergeNewTranslations(); return $this; } /** - * Get ogTitle. + * Get ogTitle w/ proxy. * * @return string */ public function getOgTitle() { - return $this->ogTitle; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgTitle'); } /** - * Set ogType. + * Set ogType w/ proxy. * * @param string $ogType * * @return PageSeo */ - public function setOgType($ogType) + public function setOgType($ogType, $locale = null) { - $this->ogType = $ogType; + $this->translate($locale, false)->setOgType($ogType); + $this->mergeNewTranslations(); return $this; } /** - * Get ogType. + * Get ogType w/ proxy. * * @return string */ public function getOgType() { - return $this->ogType; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgType'); } /** - * Set ogImage. + * Set ogImage w/ proxy. * * @param Image $ogImage * * @return PageSeo */ - public function setOgImage($ogImage) + public function setOgImage($ogImage, $locale = null) { - $this->ogImage = $ogImage; + $this->translate($locale, false)->setOgImage($ogImage); + $this->mergeNewTranslations(); return $this; } /** - * Get ogImage. + * Get ogImage w/ proxy. * * @return string */ public function getOgImage() { - return $this->ogImage; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgImage'); } /** - * Set ogUrl. + * Set ogUrl w/ proxy. * * @param string $ogUrl * * @return PageSeo */ - public function setOgUrl($ogUrl) + public function setOgUrl($ogUrl, $locale = null) { - $this->ogUrl = $ogUrl; + $this->translate($locale, false)->setOgUrl($ogUrl); + $this->mergeNewTranslations(); return $this; } /** - * Get ogUrl. + * Get ogUrl w/ proxy. * * @return string */ public function getOgUrl() { - return $this->ogUrl; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgUrl'); } /** - * Set ogDescription. + * Set ogDescription w/ proxy. * * @param string $ogDescription * * @return PageSeo */ - public function setOgDescription($ogDescription) + public function setOgDescription($ogDescription, $locale = null) { - $this->ogDescription = $ogDescription; + $this->translate($locale, false)->setOgDescription($ogDescription); + $this->mergeNewTranslations(); return $this; } /** - * Get ogDescription. + * Get ogDescription w/ proxy. * * @return string */ public function getOgDescription() { - return $this->ogDescription; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgDescription'); } /** - * Set fbAdmins. + * Set fbAdmins w/ proxy. * * @param string $fbAdmins * * @return PageSeo */ - public function setFbAdmins($fbAdmins) + public function setFbAdmins($fbAdmins, $locale = null) { - $this->fbAdmins = $fbAdmins; + $this->translate($locale, false)->setFbAdmins($fbAdmins); + $this->mergeNewTranslations(); return $this; } /** - * Get fbAdmins. + * Get fbAdmins w/ proxy. * * @return string */ public function getFbAdmins() { - return $this->fbAdmins; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getFbAdmins'); } /** - * Set twitterCard. + * Set twitterCard w/ proxy. * * @param string $twitterCard * * @return PageSeo */ - public function setTwitterCard($twitterCard) + public function setTwitterCard($twitterCard, $locale = null) { - $this->twitterCard = $twitterCard; + $this->translate($locale, false)->setTwitterCard($twitterCard); + $this->mergeNewTranslations(); return $this; } /** - * Get twitterCard. + * Get twitterCard w/ proxy. * * @return string */ public function getTwitterCard() { - return $this->twitterCard; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterCard'); } /** - * Set twitterUrl. + * Set twitterUrl w/ proxy. * * @param string $twitterUrl * * @return PageSeo */ - public function setTwitterUrl($twitterUrl) + public function setTwitterUrl($twitterUrl, $locale = null) { - $this->twitterUrl = $twitterUrl; + $this->translate($locale, false)->setTwitterUrl($twitterUrl); + $this->mergeNewTranslations(); return $this; } /** - * Get twitterUrl. + * Get twitterUrl w/ proxy. * * @return string */ public function getTwitterUrl() { - return $this->twitterUrl; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterUrl'); } /** - * Set twitterCreator. + * Set twitterCreator w/ proxy. * * @param string $twitterCreator * * @return PageSeo */ - public function setTwitterCreator($twitterCreator) + public function setTwitterCreator($twitterCreator, $locale = null) { - $this->twitterCreator = $twitterCreator; + $this->translate($locale, false)->setTwitterCreator($twitterCreator); + $this->mergeNewTranslations(); return $this; } /** - * Get twitterCreator. + * Get twitterCreator w/ proxy. * * @return string */ public function getTwitterCreator() { - return $this->twitterCreator; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterCreator'); } /** - * Set twitterTitle. + * Set twitterTitle w/ proxy. * * @param string $twitterTitle * * @return PageSeo */ - public function setTwitterTitle($twitterTitle) + public function setTwitterTitle($twitterTitle, $locale = null) { - $this->twitterTitle = $twitterTitle; + $this->translate($locale, false)->setTwitterTitle($twitterTitle); + $this->mergeNewTranslations(); return $this; } /** - * Get twitterTitle. + * Get twitterTitle w/ proxy. * * @return string */ public function getTwitterTitle() { - return $this->twitterTitle; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterTitle'); } /** - * Set twitterDescription. + * Set twitterDescription w/ proxy. * * @param string $twitterDescription * * @return PageSeo */ - public function setTwitterDescription($twitterDescription) + public function setTwitterDescription($twitterDescription, $locale = null) { - $this->twitterDescription = $twitterDescription; + $this->translate($locale, false)->setTwitterDescription($twitterDescription); + $this->mergeNewTranslations(); return $this; } /** - * Get twitterDescription. + * Get twitterDescription w/ proxy. * * @return string */ public function getTwitterDescription() { - return $this->twitterDescription; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterDescription'); } /** - * Set twitterImage. + * Set twitterImage w/ proxy. * * @param Image $twitterImage * * @return PageSeo */ - public function setTwitterImage($twitterImage) + public function setTwitterImage($twitterImage, $locale = null) { - $this->twitterImage = $twitterImage; + $this->translate($locale, false)->setTwitterImage($twitterImage); + $this->mergeNewTranslations(); return $this; } /** - * Get twitterImage. + * Get twitterImage w/ proxy. * * @return string */ public function getTwitterImage() { - return $this->twitterImage; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterImage'); } /** - * Set schemaPageType. + * Set schemaPageType w/ proxy. * * @param string $schemaPageType * * @return PageSeo */ - public function setSchemaPageType($schemaPageType) + public function setSchemaPageType($schemaPageType, $locale = null) { - $this->schemaPageType = $schemaPageType; + $this->translate($locale, false)->setSchemaPageType($schemaPageType); + $this->mergeNewTranslations(); return $this; } /** - * Get schemaPageType. + * Get schemaPageType w/ proxy. * * @return string */ public function getSchemaPageType() { - return $this->schemaPageType; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaPageType'); } /** - * Set schemaName. + * Set schemaName w/ proxy. * * @param string $schemaName * * @return PageSeo */ - public function setSchemaName($schemaName) + public function setSchemaName($schemaName, $locale = null) { - $this->schemaName = $schemaName; + $this->translate($locale, false)->setSchemaName($schemaName); + $this->mergeNewTranslations(); return $this; } /** - * Get schemaName. + * Get schemaName w/ proxy. * * @return string */ public function getSchemaName() { - return $this->schemaName; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaName'); } /** - * Set schemaDescription. + * Set schemaDescription w/ proxy. * * @param string $schemaDescription * * @return PageSeo */ - public function setSchemaDescription($schemaDescription) + public function setSchemaDescription($schemaDescription, $locale = null) { - $this->schemaDescription = $schemaDescription; + $this->translate($locale, false)->setSchemaDescription($schemaDescription); + $this->mergeNewTranslations(); return $this; } /** - * Get schemaDescription. + * Get schemaDescription w/ proxy. * * @return string */ public function getSchemaDescription() { - return $this->schemaDescription; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaDescription'); } /** - * Set schemaImage. + * Set schemaImage w/ proxy. * * @param Image $schemaImage * * @return PageSeo */ - public function setSchemaImage($schemaImage) + public function setSchemaImage($schemaImage, $locale = null) { - $this->schemaImage = $schemaImage; + $this->translate($locale, false)->setSchemaImage($schemaImage); + $this->mergeNewTranslations(); return $this; } /** - * Get schemaImage. + * Get schemaImage w/ proxy. * * @return string */ public function getSchemaImage() { - return $this->schemaImage; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaImage'); } /** - * Set metaRobotsIndex. + * Set metaRobotsIndex w/ proxy. * * @param string $metaRobotsIndex * * @return PageSeo */ - public function setMetaRobotsIndex($metaRobotsIndex) + public function setMetaRobotsIndex($metaRobotsIndex, $locale = null) { - $this->metaRobotsIndex = $metaRobotsIndex; + $this->translate($locale, false)->setMetaRobotsIndex($metaRobotsIndex); + $this->mergeNewTranslations(); return $this; } /** - * Get metaRobotsIndex. + * Get metaRobotsIndex w/ proxy. * * @return string */ public function getMetaRobotsIndex() { - return $this->metaRobotsIndex; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaRobotsIndex'); } /** - * Set metaRobotsFollow. + * Set metaRobotsFollow w/ proxy. * * @param string $metaRobotsFollow * * @return PageSeo */ - public function setMetaRobotsFollow($metaRobotsFollow) + public function setMetaRobotsFollow($metaRobotsFollow, $locale = null) { - $this->metaRobotsFollow = $metaRobotsFollow; + $this->translate($locale, false)->setMetaRobotsFollow($metaRobotsFollow); + $this->mergeNewTranslations(); return $this; } /** - * Get metaRobotsFollow. + * Get metaRobotsFollow w/ proxy. * * @return string */ public function getMetaRobotsFollow() { - return $this->metaRobotsFollow; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaRobotsFollow'); } /** - * Set metaRobotsAdvanced. + * Set metaRobotsAdvanced w/ proxy. * * @param string $metaRobotsAdvanced * * @return PageSeo */ - public function setMetaRobotsAdvanced($metaRobotsAdvanced) + public function setMetaRobotsAdvanced($metaRobotsAdvanced, $locale = null) { - $this->metaRobotsAdvanced = $metaRobotsAdvanced; + $this->translate($locale, false)->setMetaRobotsAdvanced($metaRobotsAdvanced); + $this->mergeNewTranslations(); return $this; } /** - * Get metaRobotsAdvanced. + * Get metaRobotsAdvanced w/ proxy. * * @return string */ public function getMetaRobotsAdvanced() { - return $this->metaRobotsAdvanced; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaRobotsAdvanced'); } /** - * Set sitemapIndexed. + * Set sitemapIndexed w/ proxy. * * @param bool $sitemapIndexed * * @return PageSeo */ - public function setSitemapIndexed($sitemapIndexed) + public function setSitemapIndexed($sitemapIndexed, $locale = null) { - $this->sitemapIndexed = $sitemapIndexed; + $this->translate($locale, false)->setSitemapIndexed($sitemapIndexed); + $this->mergeNewTranslations(); return $this; } @@ -892,106 +897,103 @@ public function isSitemapIndexed() } /** - * Set sitemapPriority. + * Set sitemapPriority w/ proxy. * * @param float $sitemapPriority * * @return PageSeo */ - public function setSitemapPriority($sitemapPriority) + public function setSitemapPriority($sitemapPriority, $locale = null) { - $this->sitemapPriority = $sitemapPriority; + $this->translate($locale, false)->setSitemapPriority($sitemapPriority); + $this->mergeNewTranslations(); return $this; } /** - * Get sitemapPriority. + * Get sitemapPriority w/ proxy. * * @return float */ public function getSitemapPriority() { - return $this->sitemapPriority; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSitemapPriority'); } /** - * Set sitemapChangeFreq. + * Set sitemapChangeFreq w/ proxy. * * @param float $sitemapChangeFreq * * @return PageSeo */ - public function setSitemapChangeFreq($sitemapChangeFreq) + public function setSitemapChangeFreq($sitemapChangeFreq, $locale = null) { - $this->sitemapChangeFreq = $sitemapChangeFreq; + $this->translate($locale, false)->setSitemapChangeFreq($sitemapChangeFreq); + $this->mergeNewTranslations(); return $this; } /** - * Get sitemapChangeFreq. + * Get sitemapChangeFreq w/ proxy. * * @return float */ public function getSitemapChangeFreq() { - return $this->sitemapChangeFreq; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSitemapChangeFreq'); } /** - * Set relCanonical. + * Set relCanonical w/ proxy. * * @param string $relCanonical * * @return PageSeo */ - public function setRelCanonical($relCanonical) + public function setRelCanonical($relCanonical, $locale = null) { - $this->relCanonical = $relCanonical; + $this->translate($locale, false)->setRelCanonical($relCanonical); + $this->mergeNewTranslations(); return $this; } /** - * Get relCanonical. + * Get relCanonical w/ proxy. * * @return string */ public function getRelCanonical() { - return $this->relCanonical; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRelCanonical'); } /** - * Set keyword. + * Set keyword w/ proxy. * * @param string $keyword + * @param null $locale * * @return PageSeo */ - public function setKeyword($keyword) + public function setKeyword($keyword, $locale = null) { - $this->keyword = $keyword; + $this->translate($locale, false)->setKeyword($keyword); + $this->mergeNewTranslations(); return $this; } /** - * Get keyword. + * Get keyword w/ proxy. * * @return string */ public function getKeyword() { - return $this->keyword; - } - - /** - * @return string - */ - public function getLocale() - { - return $this->locale; + return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getKeyword'); } } diff --git a/Bundle/SeoBundle/Entity/PageSeoTranslation.php b/Bundle/SeoBundle/Entity/PageSeoTranslation.php new file mode 100644 index 000000000..76d7898ba --- /dev/null +++ b/Bundle/SeoBundle/Entity/PageSeoTranslation.php @@ -0,0 +1,939 @@ +id; + } + + /** + * Set redirectTo. + * + * @param View $redirectTo + * + * @return PageSeo + */ + public function setRedirectTo(Link $redirectTo) + { + $this->redirectTo = $redirectTo; + + return $this; + } + + /** + * Get redirectTo. + * + * @return string + */ + public function getRedirectTo() + { + return $this->redirectTo; + } + + /** + * Set metaTitle. + * + * @param string $metaTitle + * + * @return PageSeo + */ + public function setMetaTitle($metaTitle) + { + $this->metaTitle = $metaTitle; + + return $this; + } + + /** + * Get metaTitle. + * + * @return string + */ + public function getMetaTitle() + { + return $this->metaTitle; + } + + /** + * Set metaDescription. + * + * @param string $metaDescription + * + * @return PageSeo + */ + public function setMetaDescription($metaDescription) + { + $this->metaDescription = $metaDescription; + + return $this; + } + + /** + * Get metaDescription. + * + * @return string + */ + public function getMetaDescription() + { + return $this->metaDescription; + } + + /** + * Set relAuthor. + * + * @param string $relAuthor + * + * @return PageSeo + */ + public function setRelAuthor($relAuthor) + { + $this->relAuthor = $relAuthor; + + return $this; + } + + /** + * Get relAuthor. + * + * @return string + */ + public function getRelAuthor() + { + return $this->relAuthor; + } + + /** + * Set relPublisher. + * + * @param string $relPublisher + * + * @return PageSeo + */ + public function setRelPublisher($relPublisher) + { + $this->relPublisher = $relPublisher; + + return $this; + } + + /** + * Get relPublisher. + * + * @return string + */ + public function getRelPublisher() + { + return $this->relPublisher; + } + + /** + * Set ogTitle. + * + * @param string $ogTitle + * + * @return PageSeo + */ + public function setOgTitle($ogTitle) + { + $this->ogTitle = $ogTitle; + + return $this; + } + + /** + * Get ogTitle. + * + * @return string + */ + public function getOgTitle() + { + return $this->ogTitle; + } + + /** + * Set ogType. + * + * @param string $ogType + * + * @return PageSeo + */ + public function setOgType($ogType) + { + $this->ogType = $ogType; + + return $this; + } + + /** + * Get ogType. + * + * @return string + */ + public function getOgType() + { + return $this->ogType; + } + + /** + * Set ogImage. + * + * @param Image $ogImage + * + * @return PageSeo + */ + public function setOgImage($ogImage) + { + $this->ogImage = $ogImage; + + return $this; + } + + /** + * Get ogImage. + * + * @return string + */ + public function getOgImage() + { + return $this->ogImage; + } + + /** + * Set ogUrl. + * + * @param string $ogUrl + * + * @return PageSeo + */ + public function setOgUrl($ogUrl) + { + $this->ogUrl = $ogUrl; + + return $this; + } + + /** + * Get ogUrl. + * + * @return string + */ + public function getOgUrl() + { + return $this->ogUrl; + } + + /** + * Set ogDescription. + * + * @param string $ogDescription + * + * @return PageSeo + */ + public function setOgDescription($ogDescription) + { + $this->ogDescription = $ogDescription; + + return $this; + } + + /** + * Get ogDescription. + * + * @return string + */ + public function getOgDescription() + { + return $this->ogDescription; + } + + /** + * Set fbAdmins. + * + * @param string $fbAdmins + * + * @return PageSeo + */ + public function setFbAdmins($fbAdmins) + { + $this->fbAdmins = $fbAdmins; + + return $this; + } + + /** + * Get fbAdmins. + * + * @return string + */ + public function getFbAdmins() + { + return $this->fbAdmins; + } + + /** + * Set twitterCard. + * + * @param string $twitterCard + * + * @return PageSeo + */ + public function setTwitterCard($twitterCard) + { + $this->twitterCard = $twitterCard; + + return $this; + } + + /** + * Get twitterCard. + * + * @return string + */ + public function getTwitterCard() + { + return $this->twitterCard; + } + + /** + * Set twitterUrl. + * + * @param string $twitterUrl + * + * @return PageSeo + */ + public function setTwitterUrl($twitterUrl) + { + $this->twitterUrl = $twitterUrl; + + return $this; + } + + /** + * Get twitterUrl. + * + * @return string + */ + public function getTwitterUrl() + { + return $this->twitterUrl; + } + + /** + * Set twitterCreator. + * + * @param string $twitterCreator + * + * @return PageSeo + */ + public function setTwitterCreator($twitterCreator) + { + $this->twitterCreator = $twitterCreator; + + return $this; + } + + /** + * Get twitterCreator. + * + * @return string + */ + public function getTwitterCreator() + { + return $this->twitterCreator; + } + + /** + * Set twitterTitle. + * + * @param string $twitterTitle + * + * @return PageSeo + */ + public function setTwitterTitle($twitterTitle) + { + $this->twitterTitle = $twitterTitle; + + return $this; + } + + /** + * Get twitterTitle. + * + * @return string + */ + public function getTwitterTitle() + { + return $this->twitterTitle; + } + + /** + * Set twitterDescription. + * + * @param string $twitterDescription + * + * @return PageSeo + */ + public function setTwitterDescription($twitterDescription) + { + $this->twitterDescription = $twitterDescription; + + return $this; + } + + /** + * Get twitterDescription. + * + * @return string + */ + public function getTwitterDescription() + { + return $this->twitterDescription; + } + + /** + * Set twitterImage. + * + * @param Image $twitterImage + * + * @return PageSeo + */ + public function setTwitterImage($twitterImage) + { + $this->twitterImage = $twitterImage; + + return $this; + } + + /** + * Get twitterImage. + * + * @return string + */ + public function getTwitterImage() + { + return $this->twitterImage; + } + + /** + * Set schemaPageType. + * + * @param string $schemaPageType + * + * @return PageSeo + */ + public function setSchemaPageType($schemaPageType) + { + $this->schemaPageType = $schemaPageType; + + return $this; + } + + /** + * Get schemaPageType. + * + * @return string + */ + public function getSchemaPageType() + { + return $this->schemaPageType; + } + + /** + * Set schemaName. + * + * @param string $schemaName + * + * @return PageSeo + */ + public function setSchemaName($schemaName) + { + $this->schemaName = $schemaName; + + return $this; + } + + /** + * Get schemaName. + * + * @return string + */ + public function getSchemaName() + { + return $this->schemaName; + } + + /** + * Set schemaDescription. + * + * @param string $schemaDescription + * + * @return PageSeo + */ + public function setSchemaDescription($schemaDescription) + { + $this->schemaDescription = $schemaDescription; + + return $this; + } + + /** + * Get schemaDescription. + * + * @return string + */ + public function getSchemaDescription() + { + return $this->schemaDescription; + } + + /** + * Set schemaImage. + * + * @param Image $schemaImage + * + * @return PageSeo + */ + public function setSchemaImage($schemaImage) + { + $this->schemaImage = $schemaImage; + + return $this; + } + + /** + * Get schemaImage. + * + * @return string + */ + public function getSchemaImage() + { + return $this->schemaImage; + } + + /** + * Set metaRobotsIndex. + * + * @param string $metaRobotsIndex + * + * @return PageSeo + */ + public function setMetaRobotsIndex($metaRobotsIndex) + { + $this->metaRobotsIndex = $metaRobotsIndex; + + return $this; + } + + /** + * Get metaRobotsIndex. + * + * @return string + */ + public function getMetaRobotsIndex() + { + return $this->metaRobotsIndex; + } + + /** + * Set metaRobotsFollow. + * + * @param string $metaRobotsFollow + * + * @return PageSeo + */ + public function setMetaRobotsFollow($metaRobotsFollow) + { + $this->metaRobotsFollow = $metaRobotsFollow; + + return $this; + } + + /** + * Get metaRobotsFollow. + * + * @return string + */ + public function getMetaRobotsFollow() + { + return $this->metaRobotsFollow; + } + + /** + * Set metaRobotsAdvanced. + * + * @param string $metaRobotsAdvanced + * + * @return PageSeo + */ + public function setMetaRobotsAdvanced($metaRobotsAdvanced) + { + $this->metaRobotsAdvanced = $metaRobotsAdvanced; + + return $this; + } + + /** + * Get metaRobotsAdvanced. + * + * @return string + */ + public function getMetaRobotsAdvanced() + { + return $this->metaRobotsAdvanced; + } + + /** + * Set sitemapIndexed. + * + * @param bool $sitemapIndexed + * + * @return PageSeo + */ + public function setSitemapIndexed($sitemapIndexed) + { + $this->sitemapIndexed = $sitemapIndexed; + + return $this; + } + + /** + * Get sitemapIndexed. + * + * @return bool + */ + public function isSitemapIndexed() + { + return $this->sitemapIndexed; + } + + /** + * Set sitemapPriority. + * + * @param float $sitemapPriority + * + * @return PageSeo + */ + public function setSitemapPriority($sitemapPriority) + { + $this->sitemapPriority = $sitemapPriority; + + return $this; + } + + /** + * Get sitemapPriority. + * + * @return float + */ + public function getSitemapPriority() + { + return $this->sitemapPriority; + } + + /** + * Set sitemapChangeFreq. + * + * @param float $sitemapChangeFreq + * + * @return PageSeo + */ + public function setSitemapChangeFreq($sitemapChangeFreq) + { + $this->sitemapChangeFreq = $sitemapChangeFreq; + + return $this; + } + + /** + * Get sitemapChangeFreq. + * + * @return float + */ + public function getSitemapChangeFreq() + { + return $this->sitemapChangeFreq; + } + + /** + * Set relCanonical. + * + * @param string $relCanonical + * + * @return PageSeo + */ + public function setRelCanonical($relCanonical) + { + $this->relCanonical = $relCanonical; + + return $this; + } + + /** + * Get relCanonical. + * + * @return string + */ + public function getRelCanonical() + { + return $this->relCanonical; + } + + /** + * Set keyword. + * + * @param string $keyword + * + * @return PageSeo + */ + public function setKeyword($keyword) + { + $this->keyword = $keyword; + + return $this; + } + + /** + * Get keyword. + * + * @return string + */ + public function getKeyword() + { + return $this->keyword; + } +} diff --git a/Bundle/SeoBundle/Form/PageSeoType.php b/Bundle/SeoBundle/Form/PageSeoType.php index 68477afec..5156036e5 100644 --- a/Bundle/SeoBundle/Form/PageSeoType.php +++ b/Bundle/SeoBundle/Form/PageSeoType.php @@ -2,11 +2,14 @@ namespace Victoire\Bundle\SeoBundle\Form; +use A2lix\TranslationFormBundle\Form\Type\TranslationsType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Victoire\Bundle\FormBundle\Form\Type\LinkType; use Victoire\Bundle\MediaBundle\Form\Type\MediaType; +use Victoire\Bundle\SeoBundle\Entity\PageSeo; class PageSeoType extends AbstractType { @@ -17,146 +20,179 @@ class PageSeoType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('metaTitle', null, [ - 'label' => 'form.pageSeo.metaTitle.label', - 'attr' => ['placeholder' => 'form.pageSeo.metaTitle.placeholder'], - ]) - ->add('metaDescription', null, [ - 'label' => 'form.pageSeo.metaDescription.label', - 'attr' => ['placeholder' => 'form.pageSeo.metaDescription.placeholder'], - ]) - ->add('relAuthor', null, [ - 'label' => 'form.pageSeo.relAuthor.label', - 'attr' => ['placeholder' => 'form.pageSeo.relAuthor.placeholder'], - ]) - ->add('relPublisher', null, [ - 'label' => 'form.pageSeo.relPublisher.label', - 'attr' => ['placeholder' => 'form.pageSeo.relPublisher.placeholder'], - ]) - ->add('ogTitle', null, [ - 'label' => 'form.pageSeo.ogTitle.label', - 'vic_help_block' => 'form.pageSeo.ogTitle.vic_help_block', - ]) - ->add('ogType', null, [ - 'label' => 'form.pageSeo.ogType.label', - 'attr' => ['placeholder' => 'form.pageSeo.ogType.placeholder'], - ]) - ->add('ogImage', MediaType::class, [ - 'label' => 'form.pageSeo.ogImage.label', - ]) - ->add('ogUrl', null, [ - 'label' => 'form.pageSeo.ogUrl.label', - 'attr' => ['placeholder' => 'form.pageSeo.ogUrl.placeholder'], - ]) - ->add('ogDescription', null, [ - 'label' => 'form.pageSeo.ogDescription.label', - ]) - ->add('fbAdmins', null, [ - 'label' => 'form.pageSeo.fbAdmins.label', - 'attr' => ['placeholder' => 'form.pageSeo.fbAdmins.placeholder'], - ]) - ->add('twitterCard', ChoiceType::class, - [ - 'label' => 'form.pageSeo.twitterCard.label', - 'choices' => [ - 'form.pageSeo.twitterCard.summary.label' => 'summary', - 'form.pageSeo.twitterCard.summary_large_image.label' => 'summary_large_image', - 'form.pageSeo.twitterCard.photo.label' => 'photo', - 'form.pageSeo.twitterCard.app.label' => 'app', - 'form.pageSeo.twitterCard.player.label' => 'player', - 'form.pageSeo.twitterCard.product.label' => 'product', - ], - 'choices_as_values' => true, - 'preferred_choices' => ['summary'], - 'vic_help_block' => 'form.pageSeo.twitterCard.vic_help_block', - ]) - ->add('twitterUrl', null, [ - 'label' => 'form.pageSeo.twitterUrl.label', - 'attr' => ['placeholder' => 'form.pageSeo.twitterUrl.placeholder'], - ]) - ->add('twitterTitle', null, [ - 'label' => 'form.pageSeo.twitterTitle.label', - 'attr' => ['placeholder' => 'form.pageSeo.twitterTitle.placeholder'], - ]) - ->add('twitterDescription', null, [ - 'label' => 'form.pageSeo.twitterDescription.label', - 'attr' => ['placeholder' => 'form.pageSeo.twitterDescription.placeholder'], - ]) - ->add('twitterCreator', null, [ - 'label' => 'form.pageSeo.twitterCreator.label', - 'attr' => ['placeholder' => 'form.pageSeo.twitterCreator.placeholder'], - ]) - ->add('twitterImage', MediaType::class, [ - 'label' => 'form.pageSeo.twitterImage.label', - ]) - ->add('schemaPageType', null, [ - 'label' => 'form.pageSeo.schemaPageType.label', - 'vic_help_block' => 'form.pageSeo.schemaPageType.vic_help_block', - ]) - ->add('schemaName', null, [ - 'label' => 'form.pageSeo.schemaName.label', - ]) - ->add('schemaDescription', null, [ - 'label' => 'form.pageSeo.schemaDescription.label', - ]) - ->add('schemaImage', MediaType::class, [ - 'label' => 'form.pageSeo.schemaImage.label', - ]) - ->add('metaRobotsIndex', ChoiceType::class, [ - 'choices_as_values' => true, - 'label' => 'form.pageSeo.metaRobotsIndex.label', - 'choices' => [ - 'form.pageSeo.metaRobotsIndex.values.index' => 'index', - 'form.pageSeo.metaRobotsIndex.values.noindex' => 'noindex', - ], - ]) - ->add('metaRobotsFollow', ChoiceType::class, [ - 'choices_as_values' => true, - 'label' => 'form.pageSeo.metaRobotsFollow.label', - 'choices' => [ - 'form.pageSeo.metaRobotsFollow.values.follow' => 'follow', - 'form.pageSeo.metaRobotsFollow.values.nofollow' => 'nofollow', + ->add('translations', TranslationsType::class, [ + 'fields' => [ + 'metaTitle' => [ + 'label' => 'form.pageSeo.metaTitle.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.metaTitle.placeholder', + ], + ], + 'metaDescription' => [ + 'label' => 'form.pageSeo.metaDescription.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.metaDescription.placeholder', + ], + ], + 'relAuthor' => [ + 'label' => 'form.pageSeo.relAuthor.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.relAuthor.placeholder', + ], + ], + 'relPublisher' => [ + 'label' => 'form.pageSeo.relPublisher.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.relPublisher.placeholder', + ], + ], + 'ogTitle' => [ + 'label' => 'form.pageSeo.ogTitle.label', + 'vic_help_block' => 'form.pageSeo.ogTitle.vic_help_block', + ], + 'ogType' => [ + 'label' => 'form.pageSeo.ogType.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.ogType.placeholder', + ], + ], + 'ogImage' => [ + 'field_type' => MediaType::class, + 'label' => 'form.pageSeo.ogImage.label', + ], + 'ogUrl' => [ + 'label' => 'form.pageSeo.ogUrl.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.ogUrl.placeholder', + ], + ], + 'ogDescription' => [ + 'label' => 'form.pageSeo.ogDescription.label', + ], + 'fbAdmins' => [ + 'label' => 'form.pageSeo.fbAdmins.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.fbAdmins.placeholder', + ], + ], + 'twitterCard' => [ + 'field_type' => ChoiceType::class, + 'label' => 'form.pageSeo.twitterCard.label', + 'choices' => [ + 'form.pageSeo.twitterCard.summary.label' => 'summary', + 'form.pageSeo.twitterCard.summary_large_image.label' => 'summary_large_image', + 'form.pageSeo.twitterCard.photo.label' => 'photo', + 'form.pageSeo.twitterCard.app.label' => 'app', + 'form.pageSeo.twitterCard.player.label' => 'player', + 'form.pageSeo.twitterCard.product.label' => 'product', + ], + 'choices_as_values' => true, + 'preferred_choices' => ['summary'], + 'vic_help_block' => 'form.pageSeo.twitterCard.vic_help_block', + ], + 'twitterUrl' => [ + 'label' => 'form.pageSeo.twitterUrl.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.twitterUrl.placeholder', + ], + ], + 'twitterTitle' => [ + 'label' => 'form.pageSeo.twitterTitle.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.twitterTitle.placeholder', + ], + ], + 'twitterDescription' => [ + 'label' => 'form.pageSeo.twitterDescription.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.twitterDescription.placeholder', + ], + ], + 'twitterCreator' => [ + 'label' => 'form.pageSeo.twitterCreator.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.twitterCreator.placeholder', + ], + ], + 'twitterImage' => [ + 'field_type' => MediaType::class, + 'label' => 'form.pageSeo.twitterImage.label', + ], + 'schemaPageType' => [ + 'label' => 'form.pageSeo.schemaPageType.label', + 'vic_help_block' => 'form.pageSeo.schemaPageType.vic_help_block', + ], + 'schemaName' => [ + 'label' => 'form.pageSeo.schemaName.label', + ], + 'schemaDescription' => [ + 'label' => 'form.pageSeo.schemaDescription.label', + ], + 'schemaImage' => [ + 'field_type' => MediaType::class, + 'label' => 'form.pageSeo.schemaImage.label', + ], + 'metaRobotsIndex' => [ + 'field_type' => ChoiceType::class, + 'choices_as_values' => true, + 'label' => 'form.pageSeo.metaRobotsIndex.label', + 'choices' => [ + 'form.pageSeo.metaRobotsIndex.values.index' => 'index', + 'form.pageSeo.metaRobotsIndex.values.noindex' => 'noindex', + ], + ], + 'metaRobotsFollow' => [ + 'field_type' => ChoiceType::class, + 'choices_as_values' => true, + 'label' => 'form.pageSeo.metaRobotsFollow.label', + 'choices' => [ + 'form.pageSeo.metaRobotsFollow.values.follow' => 'follow', + 'form.pageSeo.metaRobotsFollow.values.nofollow' => 'nofollow', + ], + ], + 'metaRobotsAdvanced' => [ + 'label' => 'form.pageSeo.metaRobotsAdvanced.label', + ], + 'sitemapIndexed' => [ + 'label' => 'form.pageSeo.sitemapIndexed.label', + ], + 'sitemapChangeFreq' => [ + 'field_type' => ChoiceType::class, + 'label' => 'form.pageSeo.sitemapChangeFreq.label', + 'choices' => [ + 'form.pageSeo.sitemapChangeFreq.format.choices.always.label' => 'always', + 'form.pageSeo.sitemapChangeFreq.format.choices.hourly.label' => 'hourly', + 'form.pageSeo.sitemapChangeFreq.format.choices.daily.label' => 'daily', + 'form.pageSeo.sitemapChangeFreq.format.choices.weekly.label' => 'weekly', + 'form.pageSeo.sitemapChangeFreq.format.choices.monthly.label' => 'monthly', + 'form.pageSeo.sitemapChangeFreq.format.choices.yearly.label' => 'yearly', + 'form.pageSeo.sitemapChangeFreq.format.choices.never.label' => 'never', + ], + 'choices_as_values' => true, + 'preferred_choices' => ['monthly'], + ], + 'sitemapPriority' => [ + 'field_type' => ChoiceType::class, + 'label' => 'form.pageSeo.sitemapPriority.label', + 'choices' => array_combine(range(0, 1, 0.1), range(0, 1, 0.1)), + 'choices_as_values' => true, + ], + 'relCanonical' => [ + 'label' => 'form.pageSeo.relCanonical.label', + ], + 'keyword' => [ + 'label' => 'form.pageSeo.keyword.label', + 'attr' => [ + 'placeholder' => 'form.pageSeo.keyword.placeholder', + ], + ], + 'redirectTo' => [ + 'field_type' => LinkType::class, + 'refresh-target' => '#basics', + 'label' => 'form.pageSeo.redirectTo.label', + 'vic_help_block' => 'form.pageSeo.redirectTo.vic_help_block', + ], ], - ]) - ->add('metaRobotsAdvanced', null, [ - 'label' => 'form.pageSeo.metaRobotsAdvanced.label', - ]) - ->add('sitemapIndexed', null, [ - 'label' => 'form.pageSeo.sitemapIndexed.label', - ]) - ->add('sitemapChangeFreq', ChoiceType::class, - [ - 'label' => 'form.pageSeo.sitemapChangeFreq.label', - 'choices' => [ - 'form.pageSeo.sitemapChangeFreq.format.choices.always.label' => 'always', - 'form.pageSeo.sitemapChangeFreq.format.choices.hourly.label' => 'hourly', - 'form.pageSeo.sitemapChangeFreq.format.choices.daily.label' => 'daily', - 'form.pageSeo.sitemapChangeFreq.format.choices.weekly.label' => 'weekly', - 'form.pageSeo.sitemapChangeFreq.format.choices.monthly.label' => 'monthly', - 'form.pageSeo.sitemapChangeFreq.format.choices.yearly.label' => 'yearly', - 'form.pageSeo.sitemapChangeFreq.format.choices.never.label' => 'never', - ], - 'choices_as_values' => true, - 'preferred_choices' => ['monthly'], - ]) - ->add('sitemapPriority', null, [ - 'label' => 'form.pageSeo.sitemapPriority.label', - ]) - ->add('sitemapPriority', ChoiceType::class, [ - 'label' => 'form.pageSeo.sitemapPriority.label', - 'choices' => array_combine(range(0, 1, 0.1), range(0, 1, 0.1)), - 'choices_as_values' => true, - ]) - ->add('relCanonical', null, [ - 'label' => 'form.pageSeo.relCanonical.label', - ]) - ->add('keyword', null, [ - 'label' => 'form.pageSeo.keyword.label', - 'attr' => ['placeholder' => 'form.pageSeo.keyword.placeholder'], - ]) - ->add('redirectTo', null, [ - 'label' => 'form.pageSeo.redirectTo.label', - 'vic_help_block' => 'form.pageSeo.redirectTo.vic_help_block', ]); } diff --git a/Bundle/SeoBundle/Resources/views/Form/localeTabs.html.twig b/Bundle/SeoBundle/Resources/views/Form/localeTabs.html.twig new file mode 100644 index 000000000..b912d963a --- /dev/null +++ b/Bundle/SeoBundle/Resources/views/Form/localeTabs.html.twig @@ -0,0 +1,98 @@ +{% block a2lix_translations_widget %} + {{ form_errors(form) }} +
+ + +
+ {% for translationsFields in form %} + {% set locale = translationsFields.vars.name %} + +
+ + + +
+
+
+ {{ form_row(translationsFields.metaTitle)}} + {{ form_row(translationsFields.metaDescription) }} + {{ form_row(translationsFields.relAuthor) }} + {{ form_row(translationsFields.relPublisher) }} + {{ form_row(translationsFields.keyword) }} +
+
+
+
+
+

{{ 'modal.form.pageSeo.OpenGraph.title'|trans({}, 'victoire') }}

+ {{ form_row(translationsFields.ogTitle) }} + {{ form_row(translationsFields.ogDescription) }} + {{ form_row(translationsFields.ogType) }} + {{ form_row(translationsFields.ogUrl) }} + {{ form_row(translationsFields.fbAdmins) }} + {{ form_row(translationsFields.ogImage) }} +
+
+

{{ 'modal.form.pageSeo.twitter.title'|trans({}, 'victoire') }}

+ {{ form_row(translationsFields.twitterCard) }} + {{ form_row(translationsFields.twitterTitle) }} + {{ form_row(translationsFields.twitterDescription) }} + {{ form_row(translationsFields.twitterCreator) }} + {{ form_row(translationsFields.twitterUrl) }} + {{ form_row(translationsFields.twitterImage) }} +
+
+
+
+
+
+

{{ 'modal.form.pageSeo.schema.title'|trans({}, 'victoire') }}

+ {{ form_row(translationsFields.schemaPageType) }} + {{ form_row(translationsFields.schemaName) }} + {{ form_row(translationsFields.schemaDescription) }} + {{ form_row(translationsFields.schemaImage) }} +
+
+

{{ 'modal.form.pageSeo.robots.title'|trans({}, 'victoire') }}

+ {{ form_row(translationsFields.metaRobotsIndex) }} + {{ form_row(translationsFields.metaRobotsFollow) }} + {{ form_row(translationsFields.metaRobotsAdvanced) }} +
+
+

{{ 'modal.form.pageSeo.sitemap.title'|trans({}, 'victoire') }}

+ {{ form_row(translationsFields.sitemapIndexed) }} + {{ form_row(translationsFields.sitemapPriority) }} + {{ form_row(translationsFields.sitemapChangeFreq) }} + {{ form_row(translationsFields.relCanonical) }} + {{ form_row(translationsFields.redirectTo) }} +
+ + {{form_rest(translationsFields)}} +
+
+
+
+ {% endfor %} +
+
+{% endblock %} + +{% block a2lix_translationsForms_widget %} + {{ block('a2lix_translations_widget') }} +{% endblock %} diff --git a/Bundle/SeoBundle/Resources/views/PageSeo/form.html.twig b/Bundle/SeoBundle/Resources/views/PageSeo/form.html.twig new file mode 100644 index 000000000..1a57e7488 --- /dev/null +++ b/Bundle/SeoBundle/Resources/views/PageSeo/form.html.twig @@ -0,0 +1,10 @@ +{% trans_default_domain "victoire" %} + +{% form_theme form 'VictoireFormBundle:Form:fields.html.twig' 'VictoireSeoBundle:Form:localeTabs.html.twig' %} + +{% if businessProperties is defined %} + {% include 'VictoireBusinessEntityBundle:BusinessProperty:list.html.twig' with { 'businessProperties':businessProperties } %} +{% endif %} +{{form_start(form)}} + +{{form_end(form)}} diff --git a/Bundle/SeoBundle/Resources/views/PageSeo/settings.html.twig b/Bundle/SeoBundle/Resources/views/PageSeo/settings.html.twig index 82073b1b9..5eabd4ba1 100644 --- a/Bundle/SeoBundle/Resources/views/PageSeo/settings.html.twig +++ b/Bundle/SeoBundle/Resources/views/PageSeo/settings.html.twig @@ -1,87 +1,12 @@ {% extends 'VictoireCoreBundle::_modal.html.twig' %} -{% trans_default_domain "victoire" %} - -{% form_theme form 'VictoireFormBundle:Form:fields.html.twig' %} - {% block modal_container_classes %}{{ parent() }} vic-view-modal{% endblock modal_container_classes %} {% block modal_body_content %}
- {% if businessProperties is defined %} - {% include 'VictoireBusinessEntityBundle:BusinessProperty:list.html.twig' with { 'businessProperties':businessProperties } %} - {% endif %} - {{form_start(form)}} - - - -
-
-
- {{ form_row(form.metaTitle)}} - {{ form_row(form.metaDescription) }} - {{ form_row(form.relAuthor) }} - {{ form_row(form.relPublisher) }} - {{ form_row(form.keyword) }} -
-
-
-
-
-

{{ 'modal.form.pageSeo.OpenGraph.title'|trans({}, 'victoire') }}

- {{ form_row(form.ogTitle) }} - {{ form_row(form.ogDescription) }} - {{ form_row(form.ogType) }} - {{ form_row(form.ogUrl) }} - {{ form_row(form.fbAdmins) }} - {{ form_row(form.ogImage) }} -
-
-

{{ 'modal.form.pageSeo.twitter.title'|trans({}, 'victoire') }}

- {{ form_row(form.twitterCard) }} - {{ form_row(form.twitterTitle) }} - {{ form_row(form.twitterDescription) }} - {{ form_row(form.twitterCreator) }} - {{ form_row(form.twitterUrl) }} - {{ form_row(form.twitterImage) }} -
-
-
-
-
-
-

{{ 'modal.form.pageSeo.schema.title'|trans({}, 'victoire') }}

- {{ form_row(form.schemaPageType) }} - {{ form_row(form.schemaName) }} - {{ form_row(form.schemaDescription) }} - {{ form_row(form.schemaImage) }} -
-
-

{{ 'modal.form.pageSeo.robots.title'|trans({}, 'victoire') }}

- {{ form_row(form.metaRobotsIndex) }} - {{ form_row(form.metaRobotsFollow) }} - {{ form_row(form.metaRobotsAdvanced) }} -
-
-

{{ 'modal.form.pageSeo.sitemap.title'|trans({}, 'victoire') }}

- {{ form_row(form.sitemapIndexed) }} - {{ form_row(form.sitemapPriority) }} - {{ form_row(form.sitemapChangeFreq) }} - {{ form_row(form.relCanonical) }} - {{ form_row(form.redirectTo) }} -
- - {{form_rest(form)}} -
-
-
- {{form_end(form)}} + {% include 'VictoireSeoBundle:PageSeo:form.html.twig' %}
{% endblock modal_body_content %}