Commit faa69768 authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller

Making mediabundle optional

parent 183f9dbd
......@@ -32,7 +32,7 @@ class ResizeUploadedImagesSubscriber implements EventSubscriberInterface
* ResizeUploadedImagesSubscriber constructor.
* @param MediaService $mediaService
*/
public function __construct(MediaService $mediaService)
public function __construct(MediaService $mediaService = null)
{
$this->mediaService = $mediaService;
}
......@@ -50,6 +50,10 @@ class ResizeUploadedImagesSubscriber implements EventSubscriberInterface
*/
public function preSubmit(FormEvent $event)
{
if ($this->mediaService === null) {
throw new \Exception('MediaService not present');
}
$content = $event->getData();
if ($content === null) {
......
services:
cwd.froala.resize_uploaded_images_subscriber:
class: Cwd\FroalaBundle\Form\EventListener\ResizeUploadedImagesSubscriber
arguments: ['@cwd.media.service']
arguments: ['@?cwd.media.service']
tags:
- { name: form.event_listener }
......
......@@ -18,9 +18,10 @@
],
"require": {
"php": ">=5.4",
"symfony/framework-bundle": ">2.7.0",
"cwd/media-bundle": ">=0.1.4"
"symfony/framework-bundle": ">2.7.0"
},
"suggest": {
"cwd/media-bundle": "to support image upload in froala editor"
},
"autoload": {
"psr-4": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment