Giter VIP home page Giter VIP logo

Comments (1)

silasjoisten avatar silasjoisten commented on June 19, 2024

@anitaeisenhaber sorry for the delay. Thanks for the detailed information.

  1. You don't need to create a custom Provider. Just override the existing ImageProvider of sonata.
    It can look like this:
<?php
//App\Application\Sonata\MediaBundle\Provider\ImageProvider.php
namespace App\Application\Sonata\MediaBundle\Provider;

use SilasJoisten\Sonata\MultiUploadBundle\Traits\MultiUploadTrait;
use Sonata\MediaBundle\Provider\ImageProvider as BaseImageProvider;

class ImageProvider extends BaseImageProvider
{
    use MultiUploadTrait;
}

Your yaml should look like:

parameters:
    sonata.media.provider.image.class: App\Application\Sonata\MediaBundle\Provider\ImageProvider

services:
    sonata.media.provider.image:
        class: "%sonata.media.provider.image.class%"
        arguments:
            - "sonata.media.provider.image"
            - "@sonata.media.filesystem.local"
            - "@sonata.media.cdn.server"
            - "@sonata.media.generator.default"
            - "@sonata.media.thumbnail.format"
            - ['jpg', 'png', 'jpeg', 'gif']
            - ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif']
            - "@sonata.media.adapter.image.default"
            - "@sonata.media.metadata.proxy"
        calls:
            - [ setTemplates, [ { helper_thumbnail: "Media/Provider/thumbnail.html.twig", helper_view: "Media/Provider/view_image.html.twig"} ] ]
        tags:
            - { name: sonata.media.provider, multi_upload: true }
        public: true

This is almost the same like yours with a few small differences regarding the classname.

This bundle does not provide a form type. It only hooks into the select_provider.html.twig and links to an multiupload action so you can access the multi upload page via. newbutton in list view.

What you could do is generate an url to the multiupload action.

from sonata-multiupload-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.