Commit 2a5984da by Julien Jorry
parent 2b94e417
......@@ -6,6 +6,7 @@
parameters:
locale: 'en'
sonata.user.admin.user.controller: 'App\Controller\CRUD\CRUDController'
sonata.media.admin.media.class: 'App\Admin\MediaAdmin'
services:
# default configuration for services in *this* file
......@@ -212,3 +213,9 @@ services:
# group: "Comptabilité"
# label: "Flux"
# public: true
# app.flash_messenger:
# class: App\Listener\Flash
# arguments: ["@session"]
# tags:
# - { name: kernel.event_listener, event: kernel.response }
\ No newline at end of file
<?php
namespace App\Admin;
use Sonata\AdminBundle\Object\Metadata;
use Sonata\MediaBundle\Admin\ORM\MediaAdmin as BaseMediaAdmin;
use Sonata\MediaBundle\Provider\MediaProviderInterface;
class MediaAdmin extends BaseMediaAdmin
{
/**
* {@inheritdoc}
*/
public function getObjectMetadata($object)
{
$provider = $this->pool->getProvider($object->getProviderName());
$url = $provider->generatePublicUrl(
$object,
$provider->getFormatName($object, MediaProviderInterface::FORMAT_ADMIN)
);
return new Metadata($object->getName(), $object->getDescription(), $url);
}
}
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