Hydrate SeoForm under SEO Tab
This commit is contained in:
@@ -23,50 +23,56 @@
|
|||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
|
||||||
use Thelia\Core\Security\Resource\AdminResources;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
|
||||||
use Thelia\Core\Event\Product\ProductDeleteEvent;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
||||||
use Thelia\Core\Event\Product\ProductCreateEvent;
|
use Thelia\Core\Event\Product\ProductCreateEvent;
|
||||||
use Thelia\Core\Security\AccessManager;
|
use Thelia\Core\Event\Product\ProductAddCategoryEvent;
|
||||||
use Thelia\Model\ProductQuery;
|
use Thelia\Core\Event\Product\ProductDeleteCategoryEvent;
|
||||||
use Thelia\Form\ProductModificationForm;
|
use Thelia\Core\Event\Product\ProductDeleteEvent;
|
||||||
use Thelia\Form\ProductCreationForm;
|
|
||||||
use Thelia\Core\Event\UpdatePositionEvent;
|
|
||||||
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
||||||
use Thelia\Core\Event\Product\ProductDeleteContentEvent;
|
use Thelia\Core\Event\Product\ProductDeleteContentEvent;
|
||||||
use Thelia\Core\Event\Product\ProductAddContentEvent;
|
use Thelia\Core\Event\Product\ProductAddContentEvent;
|
||||||
use Thelia\Model\FolderQuery;
|
|
||||||
use Thelia\Model\ContentQuery;
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
|
||||||
use Thelia\Model\ProductAssociatedContentQuery;
|
|
||||||
use Thelia\Model\AccessoryQuery;
|
|
||||||
use Thelia\Model\CategoryQuery;
|
|
||||||
|
|
||||||
use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
|
use Thelia\Core\Event\Product\ProductAddAccessoryEvent;
|
||||||
use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent;
|
use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent;
|
||||||
use Thelia\Model\ProductSaleElementsQuery;
|
use Thelia\Core\Event\Product\ProductCombinationGenerationEvent;
|
||||||
|
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
|
||||||
|
use Thelia\Core\Event\UpdatePositionEvent;
|
||||||
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementDeleteEvent;
|
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementDeleteEvent;
|
||||||
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementUpdateEvent;
|
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementUpdateEvent;
|
||||||
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
|
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent;
|
||||||
|
|
||||||
|
use Thelia\Core\Security\Resource\AdminResources;
|
||||||
|
use Thelia\Core\Security\AccessManager;
|
||||||
|
|
||||||
|
use Thelia\Model\AccessoryQuery;
|
||||||
|
use Thelia\Model\CategoryQuery;
|
||||||
|
use Thelia\Model\FolderQuery;
|
||||||
|
use Thelia\Model\ContentQuery;
|
||||||
use Thelia\Model\AttributeQuery;
|
use Thelia\Model\AttributeQuery;
|
||||||
use Thelia\Model\AttributeAvQuery;
|
use Thelia\Model\AttributeAvQuery;
|
||||||
use Thelia\Form\ProductSaleElementUpdateForm;
|
use Thelia\Model\ProductQuery;
|
||||||
|
use Thelia\Model\ProductAssociatedContentQuery;
|
||||||
|
use Thelia\Model\ProductSaleElementsQuery;
|
||||||
use Thelia\Model\ProductPriceQuery;
|
use Thelia\Model\ProductPriceQuery;
|
||||||
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
|
|
||||||
use Thelia\Model\ProductPrice;
|
use Thelia\Model\ProductPrice;
|
||||||
use Thelia\Model\Currency;
|
use Thelia\Model\Currency;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Thelia\TaxEngine\Calculator;
|
|
||||||
use Thelia\Model\Country;
|
|
||||||
use Thelia\Tools\NumberFormat;
|
|
||||||
use Thelia\Model\Product;
|
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
|
use Thelia\Model\Country;
|
||||||
|
use Thelia\Model\Product;
|
||||||
|
|
||||||
|
use Thelia\Form\ProductCreationForm;
|
||||||
|
use Thelia\Form\ProductModificationForm;
|
||||||
|
use Thelia\Form\ProductSaleElementUpdateForm;
|
||||||
|
use Thelia\Form\ProductDefaultSaleElementUpdateForm;
|
||||||
use Thelia\Form\ProductCombinationGenerationForm;
|
use Thelia\Form\ProductCombinationGenerationForm;
|
||||||
use Thelia\Core\Event\Product\ProductCombinationGenerationEvent;
|
use Thelia\Form\SeoForm;
|
||||||
use Thelia\Core\Event\Product\ProductSetTemplateEvent;
|
|
||||||
|
use Thelia\TaxEngine\Calculator;
|
||||||
|
use Thelia\Tools\NumberFormat;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages products
|
* Manages products
|
||||||
@@ -89,7 +95,8 @@ class ProductController extends AbstractCrudController
|
|||||||
TheliaEvents::PRODUCT_DELETE,
|
TheliaEvents::PRODUCT_DELETE,
|
||||||
|
|
||||||
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY,
|
TheliaEvents::PRODUCT_TOGGLE_VISIBILITY,
|
||||||
TheliaEvents::PRODUCT_UPDATE_POSITION
|
TheliaEvents::PRODUCT_UPDATE_POSITION,
|
||||||
|
TheliaEvents::PRODUCT_UPDATE_SEO
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,9 +160,9 @@ class ProductController extends AbstractCrudController
|
|||||||
|
|
||||||
protected function getUpdateEvent($formData)
|
protected function getUpdateEvent($formData)
|
||||||
{
|
{
|
||||||
|
|
||||||
$changeEvent = new ProductUpdateEvent($formData['id']);
|
$changeEvent = new ProductUpdateEvent($formData['id']);
|
||||||
|
|
||||||
// Create and dispatch the change event
|
|
||||||
$changeEvent
|
$changeEvent
|
||||||
->setLocale($formData['locale'])
|
->setLocale($formData['locale'])
|
||||||
->setTitle($formData['title'])
|
->setTitle($formData['title'])
|
||||||
@@ -163,10 +170,10 @@ class ProductController extends AbstractCrudController
|
|||||||
->setDescription($formData['description'])
|
->setDescription($formData['description'])
|
||||||
->setPostscriptum($formData['postscriptum'])
|
->setPostscriptum($formData['postscriptum'])
|
||||||
->setVisible($formData['visible'])
|
->setVisible($formData['visible'])
|
||||||
->setUrl($formData['url'])
|
|
||||||
->setDefaultCategory($formData['default_category'])
|
->setDefaultCategory($formData['default_category'])
|
||||||
;
|
;
|
||||||
|
|
||||||
|
// Create and dispatch the change event
|
||||||
return $changeEvent;
|
return $changeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +314,20 @@ class ProductController extends AbstractCrudController
|
|||||||
$this->getParserContext()->addForm($combinationPseForm);
|
$this->getParserContext()->addForm($combinationPseForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The "SEO" tab form
|
||||||
|
$data = array(
|
||||||
|
'id' => $object->getId(),
|
||||||
|
'locale' => $object->getLocale(),
|
||||||
|
'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);
|
||||||
|
|
||||||
|
|
||||||
// The "General" tab form
|
// The "General" tab form
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $object->getId(),
|
'id' => $object->getId(),
|
||||||
@@ -317,7 +338,6 @@ class ProductController extends AbstractCrudController
|
|||||||
'description' => $object->getDescription(),
|
'description' => $object->getDescription(),
|
||||||
'postscriptum' => $object->getPostscriptum(),
|
'postscriptum' => $object->getPostscriptum(),
|
||||||
'visible' => $object->getVisible(),
|
'visible' => $object->getVisible(),
|
||||||
'url' => $object->getRewrittenUrl($this->getCurrentEditionLocale()),
|
|
||||||
'default_category' => $object->getDefaultCategoryId()
|
'default_category' => $object->getDefaultCategoryId()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user