Giter Site home page Giter Site logo

gwini / fileuploadformtypebundle Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 155 KB

Helper bundle for mapping Dropzone.js frontend to Symfony FormType using File entity

License: GNU General Public License v3.0

PHP 40.67% CSS 8.94% JavaScript 36.94% Twig 13.45%

fileuploadformtypebundle's Introduction

FileUploadFormTypeBundle

Helper bundle for mapping Dropzone.js frontend to Symfony FormType using File entity

This bundle was heavily inspired by sopinet/UploadFilesBundle.

Installation

Installing prerequisites

Make sure you have Oneup\UploaderBundle installed and configured before you proceed.
See their documentation for setting up this bundle.

Note: Make sure you enable orphanage management by setting the use_orphanage configuration setting to true.

Installing the bundle

Use composer to install the bundle

$ composer require curious-inc/file-upload-form-type-bundle

Registering the bundle in AppKernel

Register both OneUp/Uploader bundle and this bundle in AppKernel

// app/AppKernel.php

$bundles = [

  ...

  new Oneup\UploaderBundle\OneupUploaderBundle(),
  new CuriousInc\FileUploadFormTypeBundle\CuriousIncFileUploadFormTypeBundle(),

  ...

]

Configuring the bundle

Routing configuration

Edit your applications routing configuration

# /app/config/routing.yml

...

# Routing for CuriousInc FileUploadFormType bundle
curious_file_upload:
    resource: '@CuriousIncFileUploadFormTypeBundle/Resources/config/routing.yml'

...
Bundle configuration

Edit your applications configuration file to reflect the following changes

Form configuration

# /app/config/config.yml

...

# Map template to FormType 
twig:
    form_themes:
        - 'CuriousIncFileUploadFormTypeBundle:Form:file.html.twig'

...

Form configuration for SonataAdmin (if applicable)

# /app/config/config.yml

...

# Sonata DoctrineOrmAdmin template overrides
sonata_doctrine_orm_admin:
    templates:
        types:
            list:
                dropzone:  '@CuriousIncFileUploadFormTypeBundle:Admin:file.html.twig'
                ...
            show:
                dropzone:  '@CuriousIncFileUploadFormTypeBundle:Admin:file.html.twig'
                ...

...

OneUp/UploaderBundle configuration

# app/config/config.yml

...

# Configuration for oneup/uploader-bundle
oneup_uploader:
    mappings:
        gallery:
            frontend: 'dropzone'
            use_orphanage: true
            namer: curious_file_upload.file_namer # needed 
            storage:
                directory: '%kernel.project_dir%/web/uploads/gallery'

...

fileuploadformtypebundle's People

Contributors

webbertakken avatar glaxdao avatar liiva avatar alex-craftsman avatar gilians avatar shushpanovvadim avatar thomasoosterbeek avatar

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.