diff --git a/core/lib/Thelia/Action/Module.php b/core/lib/Thelia/Action/Module.php index a994288d9..d27bedd1f 100644 --- a/core/lib/Thelia/Action/Module.php +++ b/core/lib/Thelia/Action/Module.php @@ -27,6 +27,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Core\Event\Cache\CacheEvent; use Thelia\Core\Event\Module\ModuleDeleteEvent; +use Thelia\Core\Event\Module\ModuleEvent; use Thelia\Core\Event\Module\ModuleToggleActivationEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Map\ModuleTableMap; @@ -99,6 +100,28 @@ class Module extends BaseAction implements EventSubscriberInterface } } + /** + * @param ModuleEvent $event + */ + public function update(ModuleEvent $event) + { + if (null !== $module = ModuleQuery::create()->findPk($event->getId())) { + + $module + ->setDispatcher($this->getDispatcher()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setChapo($event->getChapo()) + ->setDescription($event->getDescription()) + ->setPostscriptum($event->getPostscriptum()) + ; + + $module->save(); + + $event->setModule($module); + } + } + protected function cacheClear() { $cacheEvent = new CacheEvent($this->container->getParameter('kernel.cache_dir')); @@ -130,7 +153,8 @@ class Module extends BaseAction implements EventSubscriberInterface { return array( TheliaEvents::MODULE_TOGGLE_ACTIVATION => array('toggleActivation', 128), - TheliaEvents::MODULE_DELETE => array('delete', 128) + TheliaEvents::MODULE_DELETE => array('delete', 128), + TheliaEvents::MODULE_UPDATE => array('update', 128), ); } } diff --git a/core/lib/Thelia/Config/Resources/form.xml b/core/lib/Thelia/Config/Resources/form.xml index ecd530b69..dd21a9232 100644 --- a/core/lib/Thelia/Config/Resources/form.xml +++ b/core/lib/Thelia/Config/Resources/form.xml @@ -122,6 +122,8 @@
+ + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 823e037b5..684a953ae 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -921,16 +921,25 @@ -