Add SEO Meta to CATEGORY/PRODUCT/FOLDER/CONTENT
This commit is contained in:
@@ -95,7 +95,7 @@ class BaseAction
|
||||
->setLocale($event->getLocale())
|
||||
->setMetaTitle($event->getMetaTitle())
|
||||
->setMetaDescription($event->getMetaDescription())
|
||||
->setMetaKeyword($event->getMetaKeyword())
|
||||
->setMetaKeywords($event->getMetaKeywords())
|
||||
|
||||
->save()
|
||||
;
|
||||
|
||||
@@ -25,8 +25,7 @@ namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
use Thelia\Exception\UrlRewritingException;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\UpdateSeoEvent;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\Category as CategoryModel;
|
||||
|
||||
@@ -74,8 +73,6 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
*/
|
||||
public function update(CategoryUpdateEvent $event)
|
||||
{
|
||||
$search = CategoryQuery::create();
|
||||
|
||||
if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) {
|
||||
|
||||
$category
|
||||
@@ -92,17 +89,22 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
->save();
|
||||
|
||||
// Update the rewritten URL, if required
|
||||
try {
|
||||
$category->setRewrittenUrl($event->getLocale(), $event->getUrl());
|
||||
} catch(UrlRewritingException $e) {
|
||||
throw new FormValidationException($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$event->setCategory($category);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a Category SEO
|
||||
*
|
||||
* @param \Thelia\Core\Event\UpdateSeoEvent $event
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateSeo(UpdateSeoEvent $event)
|
||||
{
|
||||
return $this->genericUpdateSeo(CategoryQuery::create(), $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a category entry
|
||||
*
|
||||
@@ -190,6 +192,7 @@ class Category extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
|
||||
|
||||
TheliaEvents::CATEGORY_UPDATE_POSITION => array("updatePosition", 128),
|
||||
TheliaEvents::CATEGORY_UPDATE_SEO => array("updateSeo", 128),
|
||||
|
||||
TheliaEvents::CATEGORY_ADD_CONTENT => array("addContent", 128),
|
||||
TheliaEvents::CATEGORY_REMOVE_CONTENT => array("removeContent", 128),
|
||||
|
||||
@@ -32,8 +32,7 @@ use Thelia\Core\Event\Content\ContentToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Exception\UrlRewritingException;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\UpdateSeoEvent;
|
||||
use Thelia\Model\ContentFolder;
|
||||
use Thelia\Model\ContentFolderQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
@@ -81,19 +80,24 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
->save()
|
||||
;
|
||||
|
||||
// Update the rewritten URL, if required
|
||||
try {
|
||||
$content->setRewrittenUrl($event->getLocale(), $event->getUrl());
|
||||
} catch(UrlRewritingException $e) {
|
||||
throw new FormValidationException($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$content->updateDefaultFolder($event->getDefaultFolder());
|
||||
|
||||
$event->setContent($content);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Content SEO
|
||||
*
|
||||
* @param \Thelia\Core\Event\UpdateSeoEvent $event
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateSeo(UpdateSeoEvent $event)
|
||||
{
|
||||
return $this->genericUpdateSeo(ContentQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function updatePosition(UpdatePositionEvent $event)
|
||||
{
|
||||
if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
|
||||
@@ -203,6 +207,7 @@ class Content extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::CONTENT_TOGGLE_VISIBILITY => array('toggleVisibility', 128),
|
||||
|
||||
TheliaEvents::CONTENT_UPDATE_POSITION => array('updatePosition', 128),
|
||||
TheliaEvents::CONTENT_UPDATE_SEO => array('updateSeo', 128),
|
||||
|
||||
TheliaEvents::CONTENT_ADD_FOLDER => array('addFolder', 128),
|
||||
TheliaEvents::CONTENT_REMOVE_FOLDER => array('removeFolder', 128),
|
||||
|
||||
@@ -29,8 +29,7 @@ use Thelia\Core\Event\Folder\FolderToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Folder\FolderUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Exception\UrlRewritingException;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Core\Event\UpdateSeoEvent;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\Folder as FolderModel;
|
||||
|
||||
@@ -58,17 +57,22 @@ class Folder extends BaseAction implements EventSubscriberInterface
|
||||
->save();
|
||||
;
|
||||
|
||||
// Update the rewritten URL, if required
|
||||
try {
|
||||
$folder->setRewrittenUrl($event->getLocale(), $event->getUrl());
|
||||
} catch(UrlRewritingException $e) {
|
||||
throw new FormValidationException($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$event->setFolder($folder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Folder SEO
|
||||
*
|
||||
* @param \Thelia\Core\Event\UpdateSeoEvent $event
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateSeo(UpdateSeoEvent $event)
|
||||
{
|
||||
return $this->genericUpdateSeo(FolderQuery::create(), $event);
|
||||
}
|
||||
|
||||
public function delete(FolderDeleteEvent $event)
|
||||
{
|
||||
if (null !== $folder = FolderQuery::create()->findPk($event->getFolderId())) {
|
||||
@@ -158,6 +162,7 @@ class Folder extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::FOLDER_TOGGLE_VISIBILITY => array("toggleVisibility", 128),
|
||||
|
||||
TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128),
|
||||
TheliaEvents::FOLDER_UPDATE_SEO => array('updateSeo', 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.categories.seo.save" path="/admin/categories/seo/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::processUpdateSeoAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.categories.set-default" path="/admin/categories/toggle-online">
|
||||
<default key="_controller">Thelia\Controller\Admin\CategoryController::setToggleVisibilityAction</default>
|
||||
</route>
|
||||
@@ -418,6 +422,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.folders.seo.save" path="/admin/folders/seo/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateSeoAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.folders.delete" path="/admin/folders/delete">
|
||||
<default key="_controller">Thelia\Controller\Admin\FolderController::deleteAction</default>
|
||||
</route>
|
||||
@@ -440,6 +448,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ContentController::processUpdateAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.content.seo.save" path="/admin/content/seo/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\ContentController::processUpdateSeoAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.content.update-position" path="/admin/content/update-position">
|
||||
<default key="_controller">Thelia\Controller\Admin\ContentController::updatePositionAction</default>
|
||||
</route>
|
||||
|
||||
@@ -121,13 +121,37 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
|
||||
->setLocale($formData['locale'])
|
||||
->setMetaTitle($formData['meta_title'])
|
||||
->setMetaDescription($formData['meta_description'])
|
||||
->setMetaKeyword($formData['meta_keyword'])
|
||||
->setMetaKeywords($formData['meta_keywords'])
|
||||
;
|
||||
|
||||
// Create and dispatch the change event
|
||||
return $updateSeoEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hydrate the SEO form for this object, before passing it to the update template
|
||||
*
|
||||
* @param unknown $object
|
||||
*/
|
||||
protected function hydrateSeoForm($object){
|
||||
// The "SEO" tab form
|
||||
$locale = $object->getLocale();
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $locale,
|
||||
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
|
||||
'meta_title' => $object->getMetaTitle(),
|
||||
'meta_description' => $object->getMetaDescription(),
|
||||
'meta_keywords' => $object->getMetaKeywords()
|
||||
);
|
||||
|
||||
$seoForm = new SeoForm($this->getRequest(), "form", $data);
|
||||
$this->getParserContext()->addForm($seoForm);
|
||||
|
||||
// URL based on the language
|
||||
$this->getParserContext()->set('url_language', $this->getUrlLanguage($locale));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update SEO modification, and either go back to the object list, or stay on the edition page.
|
||||
*
|
||||
|
||||
@@ -47,7 +47,7 @@ use Thelia\Model\CategoryAssociatedContentQuery;
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class CategoryController extends AbstractCrudController
|
||||
class CategoryController extends AbstractSeoCrudController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -62,7 +62,8 @@ class CategoryController extends AbstractCrudController
|
||||
TheliaEvents::CATEGORY_UPDATE,
|
||||
TheliaEvents::CATEGORY_DELETE,
|
||||
TheliaEvents::CATEGORY_TOGGLE_VISIBILITY,
|
||||
TheliaEvents::CATEGORY_UPDATE_POSITION
|
||||
TheliaEvents::CATEGORY_UPDATE_POSITION,
|
||||
TheliaEvents::CATEGORY_UPDATE_SEO
|
||||
);
|
||||
}
|
||||
|
||||
@@ -102,7 +103,6 @@ class CategoryController extends AbstractCrudController
|
||||
->setDescription($formData['description'])
|
||||
->setPostscriptum($formData['postscriptum'])
|
||||
->setVisible($formData['visible'])
|
||||
->setUrl($formData['url'])
|
||||
->setParent($formData['parent'])
|
||||
;
|
||||
|
||||
@@ -130,7 +130,10 @@ class CategoryController extends AbstractCrudController
|
||||
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Prepare the data that will hydrate the form
|
||||
// Hydrate the "SEO" tab form
|
||||
$this->hydrateSeoForm($object);
|
||||
|
||||
// The "General" tab form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $object->getLocale(),
|
||||
@@ -139,7 +142,6 @@ class CategoryController extends AbstractCrudController
|
||||
'description' => $object->getDescription(),
|
||||
'postscriptum' => $object->getPostscriptum(),
|
||||
'visible' => $object->getVisible(),
|
||||
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
|
||||
'parent' => $object->getParent()
|
||||
);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ use Thelia\Model\ContentQuery;
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author manuel raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ContentController extends AbstractCrudController
|
||||
class ContentController extends AbstractSeoCrudController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
@@ -57,7 +57,8 @@ class ContentController extends AbstractCrudController
|
||||
TheliaEvents::CONTENT_UPDATE,
|
||||
TheliaEvents::CONTENT_DELETE,
|
||||
TheliaEvents::CONTENT_TOGGLE_VISIBILITY,
|
||||
TheliaEvents::CONTENT_UPDATE_POSITION
|
||||
TheliaEvents::CONTENT_UPDATE_POSITION,
|
||||
TheliaEvents::CONTENT_UPDATE_SEO
|
||||
);
|
||||
}
|
||||
|
||||
@@ -140,6 +141,9 @@ class ContentController extends AbstractCrudController
|
||||
*/
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Hydrate the "SEO" tab form
|
||||
$this->hydrateSeoForm($object);
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
@@ -148,8 +152,7 @@ class ContentController extends AbstractCrudController
|
||||
'chapo' => $object->getChapo(),
|
||||
'description' => $object->getDescription(),
|
||||
'postscriptum' => $object->getPostscriptum(),
|
||||
'visible' => $object->getVisible(),
|
||||
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
|
||||
'visible' => $object->getVisible()
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
@@ -191,7 +194,6 @@ class ContentController extends AbstractCrudController
|
||||
->setDescription($formData['description'])
|
||||
->setPostscriptum($formData['postscriptum'])
|
||||
->setVisible($formData['visible'])
|
||||
->setUrl($formData['url'])
|
||||
->setDefaultFolder($formData['default_folder']);
|
||||
|
||||
return $contentUpdateEvent;
|
||||
|
||||
@@ -38,7 +38,7 @@ use Thelia\Model\FolderQuery;
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class FolderController extends AbstractCrudController
|
||||
class FolderController extends AbstractSeoCrudController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
@@ -54,7 +54,8 @@ class FolderController extends AbstractCrudController
|
||||
TheliaEvents::FOLDER_UPDATE,
|
||||
TheliaEvents::FOLDER_DELETE,
|
||||
TheliaEvents::FOLDER_TOGGLE_VISIBILITY,
|
||||
TheliaEvents::FOLDER_UPDATE_POSITION
|
||||
TheliaEvents::FOLDER_UPDATE_POSITION,
|
||||
TheliaEvents::FOLDER_UPDATE_SEO
|
||||
);
|
||||
}
|
||||
|
||||
@@ -81,6 +82,9 @@ class FolderController extends AbstractCrudController
|
||||
*/
|
||||
protected function hydrateObjectForm($object)
|
||||
{
|
||||
// Hydrate the "SEO" tab form
|
||||
$this->hydrateSeoForm($object);
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
@@ -90,7 +94,6 @@ class FolderController extends AbstractCrudController
|
||||
'description' => $object->getDescription(),
|
||||
'postscriptum' => $object->getPostscriptum(),
|
||||
'visible' => $object->getVisible(),
|
||||
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
|
||||
'parent' => $object->getParent()
|
||||
);
|
||||
|
||||
@@ -132,7 +135,6 @@ class FolderController extends AbstractCrudController
|
||||
->setDescription($formData['description'])
|
||||
->setPostscriptum($formData['postscriptum'])
|
||||
->setVisible($formData['visible'])
|
||||
->setUrl($formData['url'])
|
||||
->setParent($formData['parent'])
|
||||
;
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ use Thelia\Form\ProductModificationForm;
|
||||
use Thelia\Form\ProductSaleElementUpdateForm;
|
||||
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
|
||||
use Thelia\Form\ProductCombinationGenerationForm;
|
||||
use Thelia\Form\SeoForm;
|
||||
|
||||
use Thelia\TaxEngine\Calculator;
|
||||
use Thelia\Tools\NumberFormat;
|
||||
@@ -314,23 +313,8 @@ class ProductController extends AbstractSeoCrudController
|
||||
$this->getParserContext()->addForm($combinationPseForm);
|
||||
}
|
||||
|
||||
// The "SEO" tab form
|
||||
$locale = $object->getLocale();
|
||||
$data = array(
|
||||
'id' => $object->getId(),
|
||||
'locale' => $locale,
|
||||
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
|
||||
'meta_title' => $object->getMetaTitle(),
|
||||
'meta_description' => $object->getMetaDescription(),
|
||||
'meta_keyword' => $object->getMetaKeyword()
|
||||
);
|
||||
|
||||
$seoForm = new SeoForm($this->getRequest(), "form", $data);
|
||||
$this->getParserContext()->addForm($seoForm);
|
||||
|
||||
// URL based on the language
|
||||
$this->getParserContext()->set('url_language', $this->getUrlLanguage($locale));
|
||||
|
||||
// Hydrate the "SEO" tab form
|
||||
$this->hydrateSeoForm($object);
|
||||
|
||||
// The "General" tab form
|
||||
$data = array(
|
||||
|
||||
@@ -33,7 +33,6 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
||||
protected $description;
|
||||
protected $postscriptum;
|
||||
|
||||
protected $url;
|
||||
protected $parent;
|
||||
|
||||
public function __construct($category_id)
|
||||
@@ -89,18 +88,6 @@ class CategoryUpdateEvent extends CategoryCreateEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
|
||||
@@ -36,8 +36,6 @@ class ContentUpdateEvent extends ContentCreateEvent
|
||||
protected $description;
|
||||
protected $postscriptum;
|
||||
|
||||
protected $url;
|
||||
|
||||
public function __construct($content_id)
|
||||
{
|
||||
$this->content_id = $content_id;
|
||||
@@ -123,24 +121,4 @@ class ContentUpdateEvent extends ContentCreateEvent
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $url
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ class FolderUpdateEvent extends FolderCreateEvent
|
||||
protected $description;
|
||||
protected $postscriptum;
|
||||
|
||||
protected $url;
|
||||
|
||||
public function __construct($folder_id)
|
||||
{
|
||||
$this->folder_id = $folder_id;
|
||||
@@ -116,22 +114,4 @@ class FolderUpdateEvent extends FolderCreateEvent
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $url
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ final class TheliaEvents
|
||||
const FOLDER_DELETE = "action.deleteFolder";
|
||||
const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility";
|
||||
const FOLDER_UPDATE_POSITION = "action.updateFolderPosition";
|
||||
const FOLDER_UPDATE_SEO = "action.updateFolderSeo";
|
||||
|
||||
const BEFORE_CREATEFOLDER = "action.before_createFolder";
|
||||
const AFTER_CREATEFOLDER = "action.after_createFolder";
|
||||
|
||||
@@ -30,25 +30,40 @@ class UpdateSeoEvent extends ActionEvent
|
||||
protected $url;
|
||||
protected $meta_title;
|
||||
protected $meta_description;
|
||||
protected $meta_keyword;
|
||||
protected $meta_keywords;
|
||||
|
||||
protected $object;
|
||||
|
||||
public function __construct($object_id, $locale = null, $url = null, $meta_title = null, $meta_description = null, $meta_keyword = null)
|
||||
/**
|
||||
* @param $object_id
|
||||
* @param null $locale
|
||||
* @param null $url
|
||||
* @param null $meta_title
|
||||
* @param null $meta_description
|
||||
* @param null $meta_keywords
|
||||
*/
|
||||
public function __construct($object_id, $locale = null, $url = null, $meta_title = null, $meta_description = null, $meta_keywords = null)
|
||||
{
|
||||
$this->object_id = $object_id;
|
||||
$this->locale = $locale;
|
||||
$this->url = $url;
|
||||
$this->meta_title = $meta_title;
|
||||
$this->meta_description = $meta_description;
|
||||
$this->meta_keyword = $meta_keyword;
|
||||
$this->meta_keywords = $meta_keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getObjectId()
|
||||
{
|
||||
return $this->object_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object_id
|
||||
* @return $this
|
||||
*/
|
||||
public function setObjectId($object_id)
|
||||
{
|
||||
$this->object_id = $object_id;
|
||||
@@ -56,11 +71,18 @@ class UpdateSeoEvent extends ActionEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $locale
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
@@ -68,11 +90,18 @@ class UpdateSeoEvent extends ActionEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $url
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
@@ -80,23 +109,18 @@ class UpdateSeoEvent extends ActionEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getMetaTitle()
|
||||
{
|
||||
return $this->meta_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $meta_title
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetaTitle($meta_title)
|
||||
{
|
||||
$this->meta_title = $meta_title;
|
||||
@@ -104,11 +128,18 @@ class UpdateSeoEvent extends ActionEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getMetaDescription()
|
||||
{
|
||||
return $this->meta_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $meta_description
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetaDescription($meta_description)
|
||||
{
|
||||
$this->meta_description = $meta_description;
|
||||
@@ -116,14 +147,21 @@ class UpdateSeoEvent extends ActionEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMetaKeyword()
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getMetaKeywords()
|
||||
{
|
||||
return $this->meta_keyword;
|
||||
return $this->meta_keywords;
|
||||
}
|
||||
|
||||
public function setMetaKeyword($meta_keyword)
|
||||
/**
|
||||
* @param $meta_keywords
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetaKeywords($meta_keywords)
|
||||
{
|
||||
$this->meta_keyword = $meta_keyword;
|
||||
$this->meta_keywords = $meta_keywords;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$search = CategoryQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -213,25 +213,28 @@ class Category extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$loopResultRow = new LoopResultRow($category);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $category->getId())
|
||||
->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$this->locale)
|
||||
->set("TITLE", $category->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("PARENT", $category->getParent())
|
||||
->set("URL", $category->getUrl($this->locale))
|
||||
->set("PRODUCT_COUNT", $category->countAllProducts())
|
||||
->set("CHILD_COUNT", $category->countChild())
|
||||
->set("VISIBLE", $category->getVisible() ? "1" : "0")
|
||||
->set("POSITION", $category->getPosition())
|
||||
->set("ID" , $category->getId())
|
||||
->set("IS_TRANSLATED" ,$category->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" ,$this->locale)
|
||||
->set("TITLE" , $category->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $category->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $category->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $category->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("PARENT" , $category->getParent())
|
||||
->set("URL" , $category->getUrl($this->locale))
|
||||
->set("META_TITLE" , $category->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $category->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
->set("META_KEYWORDS" , $category->getVirtualColumn('i18n_META_KEYWORDS'))
|
||||
->set("PRODUCT_COUNT" , $category->countAllProducts())
|
||||
->set("CHILD_COUNT" , $category->countChild())
|
||||
->set("VISIBLE" , $category->getVisible() ? "1" : "0")
|
||||
->set("POSITION" , $category->getPosition())
|
||||
|
||||
->set("HAS_PREVIOUS", $previous != null ? 1 : 0)
|
||||
->set("HAS_NEXT" , $next != null ? 1 : 0)
|
||||
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
|
||||
->set("HAS_NEXT" , $next != null ? 1 : 0)
|
||||
|
||||
->set("PREVIOUS", $previous != null ? $previous->getId() : -1)
|
||||
->set("NEXT" , $next != null ? $next->getId() : -1)
|
||||
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
|
||||
->set("NEXT" , $next != null ? $next->getId() : -1)
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -85,7 +85,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$search = ContentQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -215,17 +215,21 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
foreach ($loopResult->getResultDataCollection() as $content) {
|
||||
$loopResultRow = new LoopResultRow($content);
|
||||
|
||||
$loopResultRow->set("ID", $content->getId())
|
||||
->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$this->locale)
|
||||
->set("TITLE",$content->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $content->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $content->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("POSITION", $content->getPosition())
|
||||
->set("DEFAULT_FOLDER", $content->getDefaultFolderId())
|
||||
->set("URL", $content->getUrl($this->locale))
|
||||
->set("VISIBLE", $content->getVisible())
|
||||
$loopResultRow->set("ID" , $content->getId())
|
||||
->set("IS_TRANSLATED" , $content->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $this->locale)
|
||||
->set("TITLE" , $content->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $content->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $content->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $content->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("URL" , $content->getUrl($this->locale))
|
||||
->set("META_TITLE" , $content->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $content->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
->set("META_KEYWORDS" , $content->getVirtualColumn('i18n_META_KEYWORDS'))
|
||||
->set("POSITION" , $content->getPosition())
|
||||
->set("DEFAULT_FOLDER" , $content->getDefaultFolderId())
|
||||
|
||||
->set("VISIBLE" , $content->getVisible())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -78,7 +78,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$search = FolderQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -164,19 +164,22 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
$loopResultRow = new LoopResultRow($folder);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $folder->getId())
|
||||
->set("IS_TRANSLATED",$folder->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$this->locale)
|
||||
->set("TITLE",$folder->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("PARENT", $folder->getParent())
|
||||
->set("URL", $folder->getUrl($this->locale))
|
||||
->set("CHILD_COUNT", $folder->countChild())
|
||||
->set("CONTENT_COUNT", $folder->countAllContents())
|
||||
->set("VISIBLE", $folder->getVisible() ? "1" : "0")
|
||||
->set("POSITION", $folder->getPosition())
|
||||
->set("ID" , $folder->getId())
|
||||
->set("IS_TRANSLATED" , $folder->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $this->locale)
|
||||
->set("TITLE" , $folder->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $folder->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $folder->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("PARENT" , $folder->getParent())
|
||||
->set("URL" , $folder->getUrl($this->locale))
|
||||
->set("META_TITLE" , $folder->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $folder->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
->set("META_KEYWORDS" , $folder->getVirtualColumn('i18n_META_KEYWORDS'))
|
||||
->set("CHILD_COUNT" , $folder->countChild())
|
||||
->set("CONTENT_COUNT" , $folder->countAllContents())
|
||||
->set("VISIBLE" , $folder->getVisible() ? "1" : "0")
|
||||
->set("POSITION" , $folder->getPosition())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -222,7 +222,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
||||
}
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -518,6 +518,9 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
||||
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("URL" , $product->getUrl($this->locale))
|
||||
->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
|
||||
->set("BEST_PRICE" , $product->getVirtualColumn('is_promo') ? $promoPrice : $price)
|
||||
->set("BEST_PRICE_TAX" , $taxedPrice - $product->getVirtualColumn('is_promo') ? $taxedPromoPrice - $promoPrice : $taxedPrice - $price)
|
||||
->set("BEST_TAXED_PRICE" , $product->getVirtualColumn('is_promo') ? $taxedPromoPrice : $taxedPrice)
|
||||
@@ -569,7 +572,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
||||
$search = ProductQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$this->configureI18nProcessing($search, array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM', 'META_TITLE', 'META_DESCRIPTION', 'META_KEYWORDS'));
|
||||
|
||||
$attributeNonStrictMatch = $this->getAttribute_non_strict_match();
|
||||
$isPSELeftJoinList = array();
|
||||
@@ -1025,6 +1028,9 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
||||
->set("DESCRIPTION" , $product->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("URL" , $product->getUrl($this->locale))
|
||||
->set("META_TITLE" , $product->getVirtualColumn('i18n_META_TITLE'))
|
||||
->set("META_DESCRIPTION" , $product->getVirtualColumn('i18n_META_DESCRIPTION'))
|
||||
->set("META_KEYWORDS" , $product->getVirtualColumn('i18n_META_KEYWORDS'))
|
||||
->set("BEST_PRICE" , $price)
|
||||
->set("BEST_PRICE_TAX" , $taxedPrice - $price)
|
||||
->set("BEST_TAXED_PRICE" , $taxedPrice)
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
class CategoryModificationForm extends CategoryCreationForm
|
||||
{
|
||||
@@ -36,12 +34,6 @@ class CategoryModificationForm extends CategoryCreationForm
|
||||
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||
|
||||
->add("url", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Rewritten URL *"),
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label_attr" => array("for" => "rewriten_url")
|
||||
))
|
||||
;
|
||||
|
||||
// Add standard description fields, excluding title and locale, which a re defined in parent class
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\StandardDescriptionFieldsTrait;
|
||||
|
||||
/**
|
||||
@@ -43,12 +41,6 @@ class ContentModificationForm extends ContentCreationForm
|
||||
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||
|
||||
->add("url", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Rewritten URL *"),
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label_attr" => array("for" => "rewritten_url")
|
||||
))
|
||||
;
|
||||
|
||||
// Add standard description fields, excluding title and locale, which a re defined in parent class
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
class FolderModificationForm extends FolderCreationForm
|
||||
{
|
||||
@@ -36,12 +34,6 @@ class FolderModificationForm extends FolderCreationForm
|
||||
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||
|
||||
->add("url", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Rewritten URL *"),
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label_attr" => array("for" => "rewriten_url")
|
||||
))
|
||||
;
|
||||
|
||||
// Add standard description fields, excluding title and locale, which a re defined in parent class
|
||||
|
||||
@@ -75,12 +75,12 @@ trait SeoFieldsTrait
|
||||
)
|
||||
);
|
||||
|
||||
if (! in_array('meta_keyword', $exclude))
|
||||
if (! in_array('meta_keywords', $exclude))
|
||||
$this->formBuilder
|
||||
->add('meta_keyword', 'text', array(
|
||||
'label' => Translator::getInstance()->trans('Meta Keyword'),
|
||||
->add('meta_keywords', 'text', array(
|
||||
'label' => Translator::getInstance()->trans('Meta Keywords'),
|
||||
'label_attr' => array(
|
||||
'for' => 'meta_keyword'
|
||||
'for' => 'meta_keywords'
|
||||
),
|
||||
'required' => false
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user