2017 © Pedro Peláez
 

symfony-bundle redkite-labs-elfinder-bundle

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

image

redkite-labs/redkite-labs-elfinder-bundle

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  • Sunday, April 13, 2014
  • by redkite-labs
  • Repository
  • 2 Watchers
  • 1 Stars
  • 1,762 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

ElFinderBundle

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2., (*1)

Installation

Clone this bundle in the vendor/bundles/RedKiteLabs directory:, (*2)

git clone git://github.com/RedKiteLabs/ElFinderBundle.git vendor/bundles/RedKiteLabs/ElFinderBundle

OR (if you're using deps file), (*3)

Add the following to the deps file:, (*4)

[ElFinderBundle]
    git=git://github.com/RedKiteLabs/ElFinderBundle.git
    target=bundles/RedKiteLabs/ElFinderBundle

Now use the vendors script to clone the newly added repositories into your project:, (*5)

php bin/vendors install

Configure the ElFinderBundle

Open the AppKernel configuration file and add the bundle to the registerBundles() method:, (*6)

public function registerBundles()
{
    $bundles = array(
        ...
        new RedKiteLabs\ElFinderBundle\RedKiteLabsElFinderBundle(),
    )
}

Register the ElFinderBundle namespaces in app/autoload.php:, (*7)

$loader->registerNamespaces(array(
    ...
    'RedKiteLabs'                     => __DIR__.'/../vendor/bundles',
));

Import the routing configuration into the routing.yml file:, (*8)

_RedKiteLabsElFinderBundle:
    resource: "@RedKiteLabsElFinderBundle/Resources/config/routing.yml"

Register the bundle into the Assetic bundles in config.yml:, (*9)

# Assetic Configuration
assetic:
    bundles: [ "RedKiteLabsElFinderBundle" ]

Initialize submodules grabbing the ElFinder vendor library. Move inside the ElFinder folder than give this commands:, (*10)

git submodule init
git submodule update

To complete the bundle configuration you must install assets as follows:, (*11)

app/console assets:install web
app/console assetic:dump

Using the object

RedKiteLabsElFinderBundle provides a ready to use controller to display the ElFinder:, (*12)

http://[yoursite]/al_showElFinder

Customize elFinder

The default connector has a very minimal configuration, so you would like to configure it on your needs. The elFinder object is loaded into the show.html.twig template, where all the required assets and initial jquery script are added. To change the configuration you shoud create a new twig template that extends the base one:, (*13)

/path/to/your/twig/template

{% extends 'RedKiteLabsElFinderBundle:ElFinder:show.html.twig' %}

This template has four blocks you may override:, (*14)

{% block stylesheet_files %}{% endblock %}

{% block javascript_files %}{% endblock %}

{% block init_script %}{% endblock %}

{% block elfinder_html %}{% endblock %}

The names speak themselves, so if you need to change the init script, you just have to override the init_script block:, (*15)

{% block init_script %}
<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('<div/>').dialogelfinder({
                url : '/al_elFinderMediaConnect',
                lang : 'en',
                width : 840,
                destroyOnClose : true
        }).dialogelfinder('instance');
    });
</script>
{% endblock %}

Read the elFinder documentation to learn more on the available options, (*16)

The connector

The url option declares the connector to use. It is the class where are defined the elFinder options, like the folder where are saved the files and so on. In the example above the al_elFinderMediaConnect route is called and the action implementstion might be:, (*17)

public function connectMediaAction()
{
    $connector = $this->container->get('el_finder_media_connector');
    $connector->connect();
}

You may notice that the connector has been injected into the Dependency Injector Container, and its implementation is:, (*18)

<parameters>
    <parameter key="el_finder.media_connector">Path\To\RedKiteLabsElFinderMediaConnector</parameter>
</parameters>

<services>
    <service id="el_finder_connector" class="%el_finder.media_connector%">
        <argument type="service" id="service_container" />
    </service>
</services>

The class RedKiteLabsElFinderMediaConnector is instantiated into the DIC. Follows a sample of its implementation:, (*19)

namespace Path\To\RedKiteLabsElFinderMediaConnector;

use RedKiteLabs\ElFinderBundle\Core\Connector\RedKiteLabsElFinderBaseConnector;

class RedKiteLabsElFinderMediaConnector extends RedKiteLabsElFinderBaseConnector
{
    protected function configure()
    {
        $request = $this->container->get('request');

        $options = array(
            'roots' => array(
                array(
                    'driver'        => 'LocalFileSystem',   // driver for accessing file system (REQUIRED)
                    'path'          => 'bundles/RedKiteLabselfinder/files/',         // path to files (REQUIRED)
                    'URL'           => $request->getScheme().'://'.$request->getHttpHost() . '/bundles/RedKiteLabselfinder/files/', // URL to files (REQUIRED)
                    'accessControl' => 'access'             // disable and hide dot starting files (OPTIONAL)
                )
            )
        );

        return $options;
    }
}

The connector extends the RedKiteLabsElFinderBaseConnector which requires the derived class to implement a configure() method where the elFinder connector's options must be declared. This function must return an array of options., (*20)

The Versions

13/04 2014

1.1.x-dev

1.1.9999999.9999999-dev http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

dev-master

9999999-dev http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

1.1.3.5

1.1.3.5 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

1.1.4

1.1.4.0 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

v1.1.4.1

1.1.4.1 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

v1.1.4.2

1.1.4.2 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

v1.1.4.3

1.1.4.3 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

v1.1.4.4

1.1.4.4 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

13/04 2014

v1.1.6

1.1.6.0 http://redkite-labs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

21/03 2014

v1.1.3

1.1.3.0 http://RedKiteLabs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

21/03 2014

v1.1.3.1

1.1.3.1 http://RedKiteLabs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

21/03 2014

v1.1.3.2

1.1.3.2 http://RedKiteLabs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

02/03 2014

v1.1.0

1.1.0.0 http://RedKiteLabs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

18/08 2013

1.1.0-beta

1.1.0.0-beta http://RedKiteLabs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs

18/08 2013

1.1.0-RC

1.1.0.0-RC http://RedKiteLabs.com

The ElFinderBundle encapsulates the elFinder file manager to be used in Symfony2.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by RedKite Labs

ajax cms elfinder file manager redkitelabs