sonata-project/SonataMediaBundle — pull request #149 by pulse00 (2012-05-10 14:28:34+00:00)
Title: Fix linke generation for media pills

This patch fixes the generation of wrong links in the MediaBundles `list` view. Currently, if a context has only 1 provider, let's say an image provider, the generated link will always contain `sonata.media.provider.file` provider, because the `DefaultRouterGenerator` merges the PersistentParameters of the admin class with the ones passed into the `generateUrl` method.

When you then select the context with the single imageprovider and upload an image, you'll end up with an `Invalid extension` validation error, because the provider is set to `file` instead of image.

The PR fixes this issue by passing in the first provider of each context to the generateUrl method in the `list` template.

Additionally, this PR shows the provider selection pills only if the selected `context` has more than one provider, otherwise the selection between `All` and `Image` makes not really sense.