Merge branches 'coupon' and 'master' of https://github.com/thelia/thelia into coupon
* 'coupon' of https://github.com/thelia/thelia: # By Manuel Raynaud # Via Manuel Raynaud * 'master' of https://github.com/thelia/thelia: allow to delete content toofle content visibility allow to load jquery offline allow update content position number
This commit is contained in:
@@ -23,8 +23,11 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\Content\ContentCreateEvent;
|
||||
use Thelia\Core\Event\Content\ContentDeleteEvent;
|
||||
use Thelia\Core\Event\Content\ContentToggleVisibilityEvent;
|
||||
use Thelia\Core\Event\Content\ContentUpdateEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Event\UpdatePositionEvent;
|
||||
use Thelia\Form\ContentCreationForm;
|
||||
use Thelia\Form\ContentModificationForm;
|
||||
use Thelia\Model\ContentQuery;
|
||||
@@ -143,7 +146,7 @@ class ContentController extends AbstractCrudController
|
||||
*/
|
||||
protected function getDeleteEvent()
|
||||
{
|
||||
// TODO: Implement getDeleteEvent() method.
|
||||
return new ContentDeleteEvent($this->getRequest()->get('content_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,4 +289,59 @@ class ContentController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put in this method post object delete processing if required.
|
||||
*
|
||||
* @param \Thelia\Core\Event\Content\ContentDeleteEvent $deleteEvent the delete event
|
||||
* @return Response a response, or null to continue normal processing
|
||||
*/
|
||||
protected function performAdditionalDeleteAction($deleteEvent)
|
||||
{
|
||||
// Redirect to parent category list
|
||||
$this->redirectToRoute(
|
||||
'admin.folders.default',
|
||||
array('parent' => $deleteEvent->getDefaultFolderId())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $event \Thelia\Core\Event\UpdatePositionEvent
|
||||
* @return null|Response
|
||||
*/
|
||||
protected function performAdditionalUpdatePositionAction($event)
|
||||
{
|
||||
|
||||
if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) {
|
||||
// Redirect to parent category list
|
||||
$this->redirectToRoute(
|
||||
'admin.folders.default',
|
||||
array('parent' => $content->getDefaultFolderId())
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $positionChangeMode
|
||||
* @param $positionValue
|
||||
* @return UpdatePositionEvent|void
|
||||
*/
|
||||
protected function createUpdatePositionEvent($positionChangeMode, $positionValue)
|
||||
{
|
||||
return new UpdatePositionEvent(
|
||||
$this->getRequest()->get('content_id', null),
|
||||
$positionChangeMode,
|
||||
$positionValue
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContentToggleVisibilityEvent|void
|
||||
*/
|
||||
protected function createToggleVisibilityEvent()
|
||||
{
|
||||
return new ContentToggleVisibilityEvent($this->getExistingObject());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user