Skip to content

Commit

Permalink
Changed the value string of the events. (BC-Break)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheeep committed Apr 13, 2013
1 parent 93c28aa commit f5d5fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions Resources/doc/custom_logic.md
Expand Up @@ -33,19 +33,20 @@ And register it in your `services.xml`.
<services>
<service id="acme_hello.upload_listener" class="Acme\HelloBundle\EventListener">
<argument type="service" id="doctrine" />
<tag name="kernel.event_listener" event="oneup.uploader.post.persist" method="onUpload" />
<tag name="kernel.event_listener" event="oneup_uploader.post_persist" method="onUpload" />
</service>
</services>
```

You can now implement you custom logic in the `onUpload` method of your EventListener.

## Use custom input data
FineUploader supports passing custom data through the request as the following examples states. For example you can pass the id of an entity you wish to paste the images to.
Many of the supported frontends support passing custom data through the request. Here's an example for [FineUploader](frontend_fineuploader.md) sending an id of an Entity along the normal request.

```html
<script type="text/javascript">
var uploader = new qq.FineUploader({
var uploader = new qq.FineUploader(
{
element: document.getElementById('fine-uploader'),
request: {
endpoint: "{{ oneup_uploader_endpoint('gallery') }}",
Expand All @@ -57,7 +58,7 @@ var uploader = new qq.FineUploader({
</script>
```

As you can see, we extended the `request` part of the Fine Uploader by adding a `params` section. These variables are accessible through the request object in the EventHander.
As you can see, we extended the `request` part of the FineUploader by adding a `params` section. These variables are accessible through the request object in the EventHander.

```php
public function onUpload(PostPersistEvent $event)
Expand Down
4 changes: 2 additions & 2 deletions UploadEvents.php
Expand Up @@ -4,6 +4,6 @@

final class UploadEvents
{
const POST_PERSIST = 'oneup.uploader.post.persist';
const POST_UPLOAD = 'oneup.uploader.post.upload';
const POST_PERSIST = 'oneup_uploader.post_persist';
const POST_UPLOAD = 'oneup_uploader.post_upload';
}

0 comments on commit f5d5fe4

Please sign in to comment.