### Full Instance Configuration Example Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md A complete example of an instance configuration including multi-home folder settings and root definitions. ```yaml fm_elfinder: instances: default: locale: fr # defaults to current request locale editor: ckeditor # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom #editor_template: custom template for your editor # default null #path_prefix: http://localhost/ # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/ fullscreen: false # default is true, applies to simple and ckeditor editors where_is_multi: roots: 0 multi_home_folder: true folder_separator: "|" #theme: smoothness # jquery theme, default is 'smoothness' #visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all connector: #debug: true|false # defaults to false roots: # at least one root must be defined, defines root filemanager directories uploads: #show_hidden: true|false # defaults to false, hides dotfiles driver: LocalFileSystem path: "/var" alias: Bibliothèque générale upload_allow: ['all'] #upload_deny: ['all'] upload_max_size: 500M # also file upload sizes restricted in php.ini attributes: - {pattern: '..', read: true, write: true, locked: false} #attributes: example of setting attributes permission # - { pattern: '/(.*?)/', read: true, write: false, locked: true } ``` -------------------------------- ### Install Flysystem Adapter Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Install the specific Flysystem adapter package required for the chosen storage backend. ```sh composer require league/flysystem-aws-s3-v3 ``` -------------------------------- ### Install FMElfinderBundle Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Use Composer to add the bundle to your project dependencies. ```sh composer require helios-ag/fm-elfinder-bundle ``` -------------------------------- ### Install Flysystem Driver Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Install the required elFinder Flysystem driver compatible with Flysystem v3. ```sh composer require "barryvdh/elfinder-flysystem-driver:^0.5" ``` -------------------------------- ### Enable community recipes for Symfony Flex Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Required to allow installation of community-contributed bundles. ```sh composer config extra.symfony.allow-contrib true ``` -------------------------------- ### Bundle Configuration Prototype Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/configuration-dump.md Use this YAML structure to define storage and database settings for the bundle. Ensure all required credentials are provided when enabling specific services. ```yaml name: ~ dropbox2_settings: enabled: false app_key: ~ app_secret: ~ access_token: ~ aliasFormat: '%s@Dropbox' path: / separator: / acceptedName: '%s@Dropbox' rootCssClass: elfinder-navbar-root-dropbox publishPermission: requested_visibility: public getThumbSize: medium box_settings: enabled: false client_id: ~ client_secret: ~ accessToken: ~ root: Box.com path: / separator: / tmbPath: '' tmbURL: '' tmpPath: '' acceptedName: '#^[^/\?*:|"<>]*[^./\?*:|"<>]$#' rootCssClass: elfinder-navbar-root-box onedrive_settings: enabled: false client_id: ~ client_secret: ~ accessToken: ~ root: OneDrive.com OneDriveApiClient: '' path: / separator: / tmbPath: '' tmbURL: '' tmpPath: '' acceptedName: '#^[^/\?*:|"<>]*[^./\?*:|"<>]$#' rootCssClass: elfinder-navbar-root-onedrive useApiThumbnail: true ftp_settings: enabled: false host: ~ user: ~ password: ~ path: ~ mysql_settings: enabled: false host: ~ user: ~ pass: ~ db: ~ port: null socket: null files_table: elfinder_file tmbPath: '' tmpPath: '' rootCssClass: elfinder-navbar-root-sql noSessionCache: hasdirs ``` -------------------------------- ### Configure StfalconTinymceBundle for TinyMCE 3.x Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/tinymce-integration.md Add the file browser callback to the theme configuration. ```yaml stfalcon_tinymce: theme: simple: file_browser_callback : 'elFinderBrowser' ``` -------------------------------- ### Import bundle routing Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Add the bundle's routes to your application configuration. ```yaml # app/config/routing.yaml elfinder: resource: "@FMElfinderBundle/Resources/config/routing.yaml" ``` -------------------------------- ### Configure Multi-Home Folder Settings Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Required configuration keys for enabling multi-home folder support in fm_elfinder.yaml. ```yaml where_is_multi: {connector}: {index of the connector} multi_home_folder: true folder_separator: {one char other of /} ``` -------------------------------- ### Configure StfalconTinymceBundle for TinyMCE 4.x Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/tinymce-integration.md Add the file browser callback to the theme configuration for version 4.x. ```yaml stfalcon_tinymce: theme: simple: file_browser_callback : elFinderBrowser ``` -------------------------------- ### Configure a root with a service-driver Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/advanced-configuration.md Use a service ID as the driver key within the fm_elfinder configuration to define a custom volume driver. ```yaml fm_elfinder: connector: roots: uploads: driver: elfinder.driver.filesystem path: uploads ``` -------------------------------- ### Configure Flysystem Adapters in config.yml Source: https://github.com/helios-ag/fmelfinderbundle/wiki/How-to-use-custom-filesystem-service-(flysystem-adapter) Define custom adapters and filesystems within the oneup_flysystem configuration block. ```yaml oneup_flysystem: adapters: adiuvo_cms_adapter_public: rackspace: lazy: true container: adiuvo_cms.opencloud_public_container filesystems: adiuvo_cms_public: adapter: adiuvo_cms_adapter_public alias: filesystem_public plugins: - adiuvo_cms.flysystem.plugin.rackspace_public_url ``` -------------------------------- ### Register bundle in AppKernel Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Manual registration for Symfony projects not using Flex. ```php { var action = $('textarea').attr('browser-url'); var config = { toolbar : 'Full', uiColor : 'White', filebrowserBrowseUrl : action+'?mode=file', filebrowserImageBrowseUrl : action+'?mode=image', filebrowserFlashBrowseUrl : action+'?mode=flash', filebrowserImageWindowWidth : '950', filebrowserImageWindowHeight : '520', filebrowserWindowWidth : '950', filebrowserWindowHeight : '520', }; ]; $('textarea#ckeditor').ckeditor(config); }) //// ``` -------------------------------- ### Initialize Summernote in Template Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/summernote-integration.md Add the initialization functions to the template containing the Summernote instance. ```jinja {{ elfinder_summernote_init('instance_name') }} {{ summernote_init() }} ``` -------------------------------- ### Default fm_elfinder bundle configuration Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/configuration-dump.md Reference for the full YAML configuration structure required to set up the fm_elfinder bundle. ```yaml # Default configuration for extension with alias: "fm_elfinder" fm_elfinder: configuration_provider: fm_elfinder.configurator.default assets_path: assets loader: fm_elfinder.loader.default instances: # Required # Prototype name: locale: null cors_support: false editor: simple editor_template: null fullscreen: true multi_home_folder: false folder_separator: '' theme: smoothness tinymce_popup_path: '' relative_path: true path_prefix: / where_is_multi: [] visible_mime_types: [] connector: debug: false binds: # Prototype name: # Prototype name: ~ plugins: # Prototype name: # Prototype name: ~ roots: # Required # Prototype name: driver: ~ # Required volume_id: 0 path: '' autoload: false phash: '' trash_hash: '' locale: '' i18n_folder_name: false mime_detect: auto mimefile: '' security_voter: '' start_path: '' encoding: UTF-8 url: '' alias: '' img_lib: auto tmb_path: .tmb tmb_path_mode: 511 tmb_url: '' tmb_size: 48 tmb_crop: true tmb_bg_color: '#ffffff' quarantine: null copy_overwrite: true copy_join: true copy_from: true copy_to: true upload_overwrite: true fileMode: 420 upload_allow: # Default: - image upload_deny: # Default: - all upload_order: # Defaults: - deny - allow upload_max_size: 0 upload_max_conn: 3 defaults: # Prototype defaults: ~ attributes: # Prototype - pattern: ~ read: true write: true locked: false hidden: false accepted_name: '/^\w[\w\s\.\%\-]*$/u' show_hidden: false disabled_commands: [] tree_deep: 0 check_subfolders: 1 separator: / date_format: 'j M Y H:i' time_format: 'H:i' archive_mimes: [] archivers: enabled: false create: # Prototype - cmd: ~ argc: ~ ext: ~ extract: ``` -------------------------------- ### Reference a pre-configured Filesystem service Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Use an existing Flysystem v3 Filesystem service directly in the fm_elfinder configuration. ```yaml fm_elfinder: instances: adapter: locale: %locale% editor: simple connector: roots: uploads: driver: Flysystem flysystem: filesystem: 'oneup_flysystem.my_filesystem' path: '' upload_allow: ['all'] ``` -------------------------------- ### Configure Custom Archivers Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/advanced-configuration.md Define archive creation and extraction commands based on mime types within the instance configuration. ```yaml fm_elfinder: instances: themes: locale: %locale% # defaults to current request locale cors_support: true editor: simple connector: debug: true # defaults to false roots: # at least one root must be defined uploads: driver: LocalFileSystem path: %theme_root% upload_allow: ['all'] upload_max_size: 10M archive_mimes: "application/zip" archivers: create: application/zip: cmd: "phpfunction" argc: "self::zipArchiveZip" ext: "zip" extract: application/myzip: cmd: "phpfunction" argc: "self::zipArchiveUnzip" ext: "zip" ``` -------------------------------- ### Bundle Configuration Schema Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/configuration-dump.md YAML structure defining the available configuration options for the bundle, including flysystem storage adapters and plugin settings. ```yaml # Prototype - cmd: ~ argc: ~ ext: ~ flysystem: enabled: false filesystem: '' type: '' adapter_service: '' options: local: enabled: false path: '' ftp: enabled: false host: '' username: '' password: '' port: 21 passive: true ssl: true timeout: 30 root: / directoryPerm: 484 sftp: enabled: false host: '' username: '' password: '' port: 21 privateKey: '' timeout: 10 root: / aws_s3_v3: enabled: false key: '' secret: '' region: '' version: '' bucket_name: '' optional_prefix: '' endpoint: null use_path_style_endpoint: false use_aws_shared_config_files: true options: [] dropbox: enabled: false app: '' token: '' glide_url: '' glide_key: '' plugins: # Prototype name: # Prototype name: ~ driver_options: # Prototype name: ``` -------------------------------- ### Extend ElFinderConfigurationReader for Custom Adapters Source: https://github.com/helios-ag/fmelfinderbundle/wiki/How-to-use-custom-filesystem-service-(flysystem-adapter) Implement custom logic to resolve filesystem services by extending the configuration reader and checking for Filesystem or AdapterInterface instances. ```php case 'custom': $service = $this->container->get($serviceName); if (is_object($service) && $service instanceof Filesystem) { $filesystem = $service; } if (is_object($service) && $service instanceof AdapterInterface) { $filesystem = new Filesystem($service); } break; ``` -------------------------------- ### Configure Flysystem in YAML Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Define filesystem roots and driver options within the fm_elfinder configuration block. ```yaml fm_elfinder: instances: default: locale: %locale% # defaults to current request locale editor: ckeditor # other options are tinymce, tinymce4, form, custom and simple fullscreen: true # defaults true, applies to simple and ckeditor editors connector: debug: false # defaults to false roots: # at least one root must be defined local: driver: Flysystem path: uploads flysystem: type: local options: local: path: %kernel.root_dir%/../web/uploads/ upload_allow: ['all'] #upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] #upload_deny: ['all'] upload_max_size: 2M dropbox: driver: Flysystem path: uploads flysystem: type: dropbox options: dropbox: token: ToKeN // can be aquired via developer console upload_allow: ['all'] aws_s3: driver: Flysystem path: uploads url: 'http://[my-bucket-name].s3.[region].amazonaws.com' tmb_url: 'self' # For thumbnail generation on aws flysystem: type: aws_s3_v3 options: aws_s3_v3: version: 'latest' key: 'MY_AWS_KEY' secret: 'MY_AWS_SECRET' region: 'MY_AWS_REGION' bucket_name: 'MY_BUCKET_NAME' # Optional default options forwarded to every S3 request # performed by the adapter (e.g. ACL, StorageClass) options: ACL: 'public-read' upload_allow: ['all'] ``` -------------------------------- ### Configure FOSCKEditorBundle Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/ckeditor-integration.md Set the file browser route in settings.yml for FOSCKEditorBundle. ```yaml fos_ck_editor: default_config: default configs: default: filebrowserBrowseRoute: elfinder filebrowserBrowseRouteParameters: [] ``` -------------------------------- ### Initialize Elfinder for TinyMCE 3.x Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/tinymce-integration.md Use the Twig helper to initialize the Elfinder instance alongside the TinyMCE editor. ```jinja {{ elfinder_tinymce_init('instance_name', {'width':'900', 'height': '450', 'title':'ElFinder 2.0'}) }} ``` ```jinja {{ tinymce_init() }} {{ elfinder_tinymce_init('instance_name') }} ``` -------------------------------- ### Configure Elfinder Instance Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/elfinder-form-type.md Define the Elfinder instance in your configuration file with the editor set to 'form'. ```yaml fm_elfinder: instances: form: locale: '%locale%' # defaults to current request locale editor: form # other choices are tinymce or simple, and form show_hidden: false # defaults to false fullscreen: true # defaults true, applies to simple and ckeditor editors connector: debug: false # defaults to false roots: # at least one root must be defined uploads: driver: LocalFileSystem path: uploads upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M ``` -------------------------------- ### Configure FMElfinderBundle for TinyMCE 3.x Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/tinymce-integration.md Set the editor type and popup path in your application configuration. ```yaml fm_elfinder: editor: tinymce tinymce_popup_path: "asset[bundles/stfalcontinymce/vendor/tiny_mce/tiny_mce_popup.js]" ``` -------------------------------- ### Configure CORS Headers with NelmioCORSBundle Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/cors-support.md Define the allowed origins, headers, and methods for the connector path to enable cross-domain access. ```yaml # app/config/config.yml nelmio_cors: defaults: allow_credentials: false allow_origin: [] allow_headers: [] allow_methods: [] expose_headers: [] max_age: 0 hosts: [] paths: '^/efconnect': allow_origin: ['*'] allow_headers: ['X-Custom-Auth', 'Content-Type', 'X-Requested-With'] allow_methods: ['POST', 'GET', 'PATCH', 'PUT', 'DELETE'] max_age: 3600 allow_credentials: true ``` -------------------------------- ### EasyAdmin 2.x Integration Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/elfinder-form-type.md Configure the property type and form theme for EasyAdmin 2.x. ```yaml - { property: 'images', type: 'collection', label: 'Images', type_options: { allow_add: false, allow_delete: false, entry_type: 'FM\ElfinderBundle\Form\Type\ElFinderType' }} ``` ```yaml design: form_theme: - '@EasyAdmin/form/bootstrap_4.html.twig' - '@FMElfinder/Form/elfinder_widget.html.twig' ``` -------------------------------- ### Implement a post-execution event listener Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/events-listeners-subscribers.md This listener handles the post-execution event, allowing for conditional logic and the execution of sub-requests. ```php // src/AppBundle/EventListener/ElFinder/PostExecutionListener.php namespace AppBundle\EventListener\ElFinder; use FM\ElfinderBundle\Event\ElFinderPostExecutionEvent; class PostExecutionListener { /** * @param ElFinderPostExecutionEvent $event */ public function onPostExecute(ElFinderPostExecutionEvent $event) { if (!$event->hasErrors() && $event->getCommand() == 'tmb') { // 'tmb', 'mkdir', 'open', etc... // do your stuff here // ... // you can perform a sub request $queryParameters = $event->getRequest()->query->all(); // getting original request parameters $queryParameters['cmd'] = 'info'; // changing the command to execute in sub request $jsonResponse = $event->subRequest(array( 'instance' => $event->getInstance(), // you can also make a subrequest on an other instance 'homeFolder' => $event->getHomeFolder() // and an other homeFolder ), $queryParameters); $data = json_decode($jsonResponse->getContent()); // work with sub request data // ... } } } ``` -------------------------------- ### Initialize Elfinder for TinyMCE 4.x Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/tinymce-integration.md Initialize the Elfinder instance before the TinyMCE editor call. ```jinja {{ elfinder_tinymce_init4('instance_name') }} {{ tinymce_init() }} ``` -------------------------------- ### Override Configuration Provider Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/advanced-configuration.md Configure the bundle to use a custom service for reading configuration from the DIC. ```yaml fm_elfinder: configuration_provider: elfinder.configurator ``` ```yaml services: my_elfinder_configurator: class: Acme\DemoBundle\MyElfinderConfigurator arguments: ["%my_arguments%"] ``` -------------------------------- ### Publish elfinder assets Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Copies the necessary assets to the public directory. ```sh bin/console elfinder:install ``` -------------------------------- ### Define a custom Flysystem adapter service Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Configure a local adapter as a service in your Symfony services configuration. ```yaml services: local_adapter: class: League\Flysystem\Local\LocalFilesystemAdapter arguments: ["%kernel.project_dir%/public/uploads/"] ``` -------------------------------- ### Configure TrsteelCKEditorBundle Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/ckeditor-integration.md Set the file browser URL in settings.yml for TrsteelCKEditorBundle. ```yaml trsteel_ckeditor: ... filebrowser_image_browse_url: route: elfinder route_parameters: instance: ckeditor ``` -------------------------------- ### Define a volume driver service Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/advanced-configuration.md Register the volume driver as a Symfony service using the appropriate class implementation. ```xml ``` -------------------------------- ### Configure Ivory CKEditor Bundle via Form Builder Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/ckeditor-integration.md Define the file browser route and parameters directly within a Symfony form builder. ```php // applies to Ivory CKEditor Bundle $form = $this->createFormBuilder() ->add('content', 'ckeditor', array( 'config' => array( 'filebrowserBrowseRoute' => 'elfinder', 'filebrowserBrowseRouteParameters' => array( 'instance' => 'default', 'homeFolder' => '' ) ), ), )) ->getForm() ; ``` -------------------------------- ### Configure ElFinder AutoResize Plugin Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/advanced-configuration.md Enables the AutoResize plugin globally and for specific filesystem roots with custom dimensions and quality settings. ```yaml fm_elfinder: instances: tinymce: locale: %locale% editor: tinymce4 relative_path: true fullscreen: true connector: debug: true # defaults to false binds: upload.presave: - Plugin.AutoResize.onUpLoadPreSave plugins: AutoResize: # global resize options, applies to root which don't have his own resize configuraion enable: true maxWidth: 750 maxHeight: 750 quality: 95 # JPEG image save quality roots: # at least one root must be defined uploads: driver: LocalFileSystem path: uploads plugins: AutoResize: enable: true maxWidth: 500 maxHeight: 500 quality: 95 # JPEG image save quality upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M resize1: driver: LocalFileSystem path: uploads plugins: AutoResize: enable: true # For control by volume driver maxWidth: 800 # Path to Water mark image maxHeight: 800 # Margin right pixel quality: 95 # JPEG image save quality upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M resize2: driver: LocalFileSystem path: uploads plugins: AutoResize: enable: true maxWidth: 800 maxHeight: 800 quality: 95 upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M ``` -------------------------------- ### Implement elFinderBrowser for TinyMCE Source: https://github.com/helios-ag/fmelfinderbundle/wiki/Integration-Guide Update the elFinderBrowser function to use the bundle's elfinder route. ```jinja //// function elFinderBrowser (field_name, url, type, win) { var elfinder_url = "{{ url('elfinder') }}"; // use an absolute path tinyMCE.activeEditor.windowManager.open({ ... //// ``` -------------------------------- ### Configure Amazon S3 in config.yml Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Defines the S3 storage driver and credentials within the fm_elfinder configuration block. ```yaml fm_elfinder: instances: default: locale: %locale% editor: ckeditor fullscreen: true relative_path: false connector: debug: false roots: aws_s3: driver: Flysystem path: uploads url: 'http://[my-bucket-name].s3.[region].amazonaws.com' tmb_url: 'self' # For thumbnail generation on aws flysystem: type: aws_s3_v3 options: aws_s3_v3: version: 'latest' key: 'MY_AWS_KEY' secret: 'MY_AWS_SECRET' region: 'MY_AWS_REGION' bucket_name: 'MY_BUCKET_NAME' options: ACL: 'public-read' upload_allow: ['all'] ``` -------------------------------- ### Configure custom adapter type in fmelfinder Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/flysystem.md Reference the custom adapter service within the fm_elfinder configuration. ```yaml fm_elfinder: instances: adapter: locale: %locale% editor: simple relative_path: true connector: roots: uploads: show_hidden: false driver: Flysystem # !set driver to Flysystem flysystem: type: custom # !set type to custom, it will tell bundle to use custom driver adapter_service: 'local_adapter' # select previously configured adapter service options: path: '' upload_allow: ['all'] ``` -------------------------------- ### Configure browser-url for CKEditor Source: https://github.com/helios-ag/fmelfinderbundle/wiki/Integration-Guide Include the browser-url attribute in the textarea to link the ElFinder path. ```jinja {# example.html.twig #} //// //// ``` -------------------------------- ### Configure TinyMCE in app/config.yml Source: https://github.com/helios-ag/fmelfinderbundle/wiki/Integration-Guide Set the editor type and path to the TinyMCE popup script in your configuration file. ```yaml fm_elfinder: editor: tinymce tinymce_popup_path: 'asset[bundle/acmedemo/path/to/tiny_mce/tiny_mce_popup.js]' ``` -------------------------------- ### Commit Message Format Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/CONTRIBUTING.md Standard format for commit messages, requiring a short summary and an optional detailed description wrapped at 72 characters. ```text Short summary of the change (up to 50 characters) Optionally add a more extensive description of your change after a blank line. Wrap the lines in this and the following paragraphs after 72 characters. ``` -------------------------------- ### Configure FMElfinderBundle for TinyMCE 4.x Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/tinymce-integration.md Set the editor type to tinymce4 in your application configuration. ```yaml fm_elfinder: editor: tinymce4 ``` -------------------------------- ### Configure Summernote in YAML Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/summernote-integration.md Set the editor type to summernote in your application configuration file. ```yaml fm_elfinder: editor: summernote ``` -------------------------------- ### Enable CORS in FMElFinderBundle Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/cors-support.md Add the cors_support option to your instance configuration to allow cross-domain response handling. ```yaml # app/config/config.yml fm_elfinder: instances: default: locale: %locale% # defaults to current request locale cors_support: true # allows cross domain responses handling (default false) editor: ckeditor # other options are tinymce, tinymce4, form, custom and simple, # ... ``` -------------------------------- ### Configure fm_elfinder in config.yaml Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Define elFinder instances, editor types, and connector roots within the Symfony configuration file. ```yaml fm_elfinder: #assets_path: / # default is /assets, this is where css/js elfinder files are instances: default: locale: '%locale%' # defaults to current request locale editor: ckeditor # other options are tinymce, tinymce4, fm_tinymce, form, simple, custom relative_path: false #default true, will produce absolute urls to specified file(s) #editor_template: custom template for your editor # default null #path_prefix: / # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/ #fullscreen: true|false # default is true, applies to simple and ckeditor editors #theme: smoothness # jquery theme, default is 'smoothness' #visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all connector: #debug: true|false # defaults to false roots: # at least one root must be defined, defines root filemanager directories uploads: #show_hidden: true|false # defaults to false, hides dotfiles driver: LocalFileSystem path: uploads upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M # also file upload sizes restricted in php.ini #attributes: example of setting attributes permission # - { pattern: '/(.*?)/', read: true, write: false, locked: true } ``` -------------------------------- ### Override Loader Service Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/advanced-configuration.md Define a custom loader service to handle ElFinder loading logic. ```yaml services: my_loader: class: AppBundle\Service\MyElFinderLoader arguments: [@fm_elfinder.configurator] fm_elfinder: loader: my_loader ``` -------------------------------- ### Register an event listener in services.xml Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/events-listeners-subscribers.md Use the fm_elfinder.event_listener tag to register a service method as a listener for a specific elFinder event. ```xml ``` -------------------------------- ### Add Elfinder to Form Builder Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/elfinder-form-type.md Use the ElFinderType class in your form builder to enable the file picker. ```php // ... use FM\ElfinderBundle\Form\Type\ElFinderType; // ... $form = $this->createFormBuilder() ->add('elfinder', ElFinderType::class, ['instance' => 'form', 'enable' => true]) ->getForm(); ``` -------------------------------- ### EasyAdmin 3.x/4.x Integration Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/elfinder-form-type.md Configure fields and form themes within the CrudController for newer EasyAdmin versions. ```php // ProjectCrudController.php // ... public function configureFields(string $pageName): iterable { // ... yield Field::new('image', 'Image') ->setFormType(ElFinderType::class) ->setFormTypeOptions([ 'instance' => 'default', 'enable' => true, ]) ->onlyOnForms() ; // ... } public function configureCrud(Crud $crud): Crud { return $crud // ... ->addFormTheme('@FMElfinder/Form/elfinder_widget.html.twig') ; } ``` ```php return [ Field::new('cover', 'Cover')->setFormType(ElFinderType::class) ->setFormTypeOptions( [ 'instance' => 'image_form', 'attr' => ['class' => 'col-6'], ] ) ->hideOnIndex(), CollectionField::new('photos', 'Photos') ->setEntryType(PhotoType::class) ]; ``` ```php public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('path', ElFinderType::class, [ 'instance' => 'image_form', 'enable' => true ]) ->add('translations', TranslationsType::class, [ 'fields' => [ 'description' => [ 'field_type' => CKEditorType::class, 'label' => 'Description', ], ], ]); } ``` -------------------------------- ### Render Elfinder Form Widget Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/elfinder-form-type.md Include the form widget in your Twig template. ```jinja
{{ form_widget(form) }}
``` -------------------------------- ### Configure security access control Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/README.md Restrict access to ElFinder routes using Symfony security roles. ```yaml # app/config/security.yaml security: //.... access_control: - { path: ^/efconnect, role: ROLE_USER } - { path: ^/elfinder, role: ROLE_USER } ``` -------------------------------- ### Define textarea for CKEditor Source: https://github.com/helios-ag/fmelfinderbundle/wiki/Integration-Guide Add a textarea element to your Twig template to serve as the CKEditor instance. ```jinja {# example.html.twig #} //// //// ``` -------------------------------- ### Override Elfinder Widget JavaScript Source: https://github.com/helios-ag/fmelfinderbundle/blob/main/docs/elfinder-form-type.md Custom JavaScript logic for handling the Elfinder popup window. ```js live('click', '[data-type="elfinder-input-field"]', function (event) { var id = $(this).attr('id'); var childWin = window.open("{{path('elfinder', {'instance': instance, 'homeFolder': homeFolder })}}?id="+id, "popupWindow", "height=450, width=900"); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.