From e247bd16de348e55d5119a846377fcc93c138f26 Mon Sep 17 00:00:00 2001 From: Brian Canini <canini.16@osu.edu> Date: Mon, 21 Dec 2020 11:45:40 -0500 Subject: [PATCH] Updating drupal/dropzonejs (2.1.0 => 2.3.0) Updating drupal/dropzonejs_eb_widget (2.1.0 => 2.1.0) --- composer.json | 2 +- composer.lock | 57 ++++++------- vendor/composer/ClassLoader.php | 2 +- vendor/composer/autoload_real.php | 3 + vendor/composer/installed.json | 60 +++++++------- web/modules/dropzonejs/.editorconfig | 5 ++ web/modules/dropzonejs/README.md | 69 +++++++++++++--- web/modules/dropzonejs/composer.json | 80 ++++++++++--------- .../dropzonejs/composer.libraries.json | 19 +++++ .../config/install/dropzonejs.settings.yml | 1 + .../config/schema/dropzonejs.schema.yml | 3 + web/modules/dropzonejs/dropzonejs.info.yml | 6 +- web/modules/dropzonejs/dropzonejs.install | 11 +++ .../eb_widget/dropzonejs_eb_widget.info.yml | 6 +- .../Widget/DropzoneJsEbWidget.php | 14 ++++ .../Widget/MediaEntityDropzoneJsEbWidget.php | 19 +++++ .../src/Controller/UploadController.php | 6 +- .../src/DropzoneJsUploadSaveInterface.php | 2 +- .../dropzonejs/src/Element/DropzoneJs.php | 3 +- .../dropzonejs_test/dropzonejs_test.info.yml | 11 +-- .../src/Form/DropzoneJsTestForm.php | 4 +- .../src/Kernel/DropzoneJsElementTest.php | 8 +- .../Kernel/DropzoneJsUploadControllerTest.php | 10 +-- 23 files changed, 270 insertions(+), 131 deletions(-) create mode 100644 web/modules/dropzonejs/.editorconfig create mode 100644 web/modules/dropzonejs/composer.libraries.json diff --git a/composer.json b/composer.json index 8d4c992ac6..7d232c5316 100644 --- a/composer.json +++ b/composer.json @@ -110,7 +110,7 @@ "drupal/ctools": "3.2", "drupal/devel": "2.0", "drupal/draggableviews": "1.0", - "drupal/dropzonejs": "2.1", + "drupal/dropzonejs": "2.3", "drupal/editor_advanced_link": "1.4", "drupal/embed": "1.0", "drupal/entity": "1.0-beta1", diff --git a/composer.lock b/composer.lock index 2a1a66c8ed..80cad81573 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c4859b7d4c9da280e0f3e2da304af0b9", + "content-hash": "ebe0c2474f7fa81e71d0f66551068a46", "packages": [ { "name": "alchemy/zippy", @@ -1982,6 +1982,7 @@ "GPL-2.0-or-later" ], "description": "Composer Plugin for updating the Drupal scaffold files when using drupal/core", + "abandoned": "drupal/core-composer-scaffold", "time": "2018-07-27T10:07:07+00:00" }, { @@ -4000,35 +4001,32 @@ }, { "name": "drupal/dropzonejs", - "version": "2.1.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/dropzonejs.git", - "reference": "8.x-2.1" + "reference": "8.x-2.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/dropzonejs-8.x-2.1.zip", - "reference": "8.x-2.1", - "shasum": "a165b70070c320933fdce0c02be3577abce5e938" + "url": "https://ftp.drupal.org/files/projects/dropzonejs-8.x-2.3.zip", + "reference": "8.x-2.3", + "shasum": "c145f2560ed31de32ea8938b0c0378765f70e36a" }, "require": { "drupal/core": "^8.8 || ^9" }, "require-dev": { - "drupal/entity_browser": "*" + "drupal/entity_browser": "^2.5" }, "suggest": { - "enyo/dropzone": "Required to user drupal/dropzonejs. Dropzone is an easy to use drag'n'drop library." + "enyo/dropzone": "Required to use drupal/dropzonejs. DropzoneJS is an open source library that provides drag’n’drop file uploads with image previews." }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - }, "drupal": { - "version": "8.x-2.1", - "datestamp": "1585662324", + "version": "8.x-2.3", + "datestamp": "1600311980", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -4037,7 +4035,7 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { @@ -4055,6 +4053,11 @@ "homepage": "https://drupal.org/u/Primsi", "role": "Maintainer" }, + { + "name": "Qiangjun Ran", + "homepage": "https://drupal.org/u/jungle", + "role": "Maintainer" + }, { "name": "See other contributors", "homepage": "https://www.drupal.org/node/1998478/committers", @@ -4082,7 +4085,7 @@ "support": { "source": "https://www.drupal.org/project/dropzonejs", "issues": "https://www.drupal.org/project/issues/dropzonejs", - "irc": "irc://irc.freenode.org/drupal-contribute" + "#media": "http://drupal.slack.com" } }, { @@ -4090,14 +4093,11 @@ "version": "2.1.0", "require": { "drupal/core": "^8.8 || ^9", - "drupal/dropzonejs": "self.version", + "drupal/dropzonejs": "*", "drupal/entity_browser": "*" }, "type": "metapackage", "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - }, "drupal": { "version": "8.x-2.1", "datestamp": "1585662324", @@ -4128,6 +4128,10 @@ "name": "chr.fritsch", "homepage": "https://www.drupal.org/user/2103716" }, + { + "name": "jungle", + "homepage": "https://www.drupal.org/user/2919723" + }, { "name": "slashrsm", "homepage": "https://www.drupal.org/user/744628" @@ -7776,13 +7780,10 @@ "shasum": "f959bec1332f2bd45e813eefa3b982df4eb129bb" }, "require": { - "drupal/core": "*" + "drupal/core": "^8" }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-3.x": "3.x-dev" - }, "drupal": { "version": "8.x-3.0-alpha0", "datestamp": "1489574283", @@ -7821,7 +7822,7 @@ "description": "Provides configurable blocks for a Twitter feed.", "homepage": "http://drupal.org/project/twitter_block", "support": { - "source": "http://cgit.drupalcode.org/twitter_block" + "source": "https://git.drupalcode.org/project/twitter_block" } }, { @@ -8820,12 +8821,12 @@ "version": "0.9.1", "source": { "type": "git", - "url": "https://github.com/njh/easyrdf.git", + "url": "https://github.com/easyrdf/easyrdf.git", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/njh/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", + "url": "https://api.github.com/repos/easyrdf/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566", "shasum": "" }, @@ -12582,6 +12583,7 @@ "i18n", "text" ], + "abandoned": true, "time": "2018-12-05T18:34:18+00:00" }, { @@ -13157,5 +13159,6 @@ "platform-dev": [], "platform-overrides": { "php": "7.0.8" - } + }, + "plugin-api-version": "1.1.0" } diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index fce8549f07..03b9bb9c40 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -60,7 +60,7 @@ class ClassLoader public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 126478a282..fe8678ed14 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -13,6 +13,9 @@ public static function loadClassLoader($class) } } + /** + * @return \Composer\Autoload\ClassLoader + */ public static function getLoader() { if (null !== self::$loader) { diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index f0a1bba986..29956e4922 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2043,7 +2043,8 @@ "license": [ "GPL-2.0-or-later" ], - "description": "Composer Plugin for updating the Drupal scaffold files when using drupal/core" + "description": "Composer Plugin for updating the Drupal scaffold files when using drupal/core", + "abandoned": "drupal/core-composer-scaffold" }, { "name": "drupal/address", @@ -4120,36 +4121,33 @@ }, { "name": "drupal/dropzonejs", - "version": "2.1.0", - "version_normalized": "2.1.0.0", + "version": "2.3.0", + "version_normalized": "2.3.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/dropzonejs.git", - "reference": "8.x-2.1" + "reference": "8.x-2.3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/dropzonejs-8.x-2.1.zip", - "reference": "8.x-2.1", - "shasum": "a165b70070c320933fdce0c02be3577abce5e938" + "url": "https://ftp.drupal.org/files/projects/dropzonejs-8.x-2.3.zip", + "reference": "8.x-2.3", + "shasum": "c145f2560ed31de32ea8938b0c0378765f70e36a" }, "require": { "drupal/core": "^8.8 || ^9" }, "require-dev": { - "drupal/entity_browser": "*" + "drupal/entity_browser": "^2.5" }, "suggest": { - "enyo/dropzone": "Required to user drupal/dropzonejs. Dropzone is an easy to use drag'n'drop library." + "enyo/dropzone": "Required to use drupal/dropzonejs. DropzoneJS is an open source library that provides drag’n’drop file uploads with image previews." }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - }, "drupal": { - "version": "8.x-2.1", - "datestamp": "1585662324", + "version": "8.x-2.3", + "datestamp": "1600311980", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -4159,7 +4157,7 @@ "installation-source": "dist", "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0+" + "GPL-2.0-or-later" ], "authors": [ { @@ -4177,6 +4175,11 @@ "homepage": "https://drupal.org/u/Primsi", "role": "Maintainer" }, + { + "name": "Qiangjun Ran", + "homepage": "https://drupal.org/u/jungle", + "role": "Maintainer" + }, { "name": "See other contributors", "homepage": "https://www.drupal.org/node/1998478/committers", @@ -4204,7 +4207,7 @@ "support": { "source": "https://www.drupal.org/project/dropzonejs", "issues": "https://www.drupal.org/project/issues/dropzonejs", - "irc": "irc://irc.freenode.org/drupal-contribute" + "#media": "http://drupal.slack.com" } }, { @@ -4213,14 +4216,11 @@ "version_normalized": "2.1.0.0", "require": { "drupal/core": "^8.8 || ^9", - "drupal/dropzonejs": "self.version", + "drupal/dropzonejs": "*", "drupal/entity_browser": "*" }, "type": "metapackage", "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - }, "drupal": { "version": "8.x-2.1", "datestamp": "1585662324", @@ -4251,6 +4251,10 @@ "name": "chr.fritsch", "homepage": "https://www.drupal.org/user/2103716" }, + { + "name": "jungle", + "homepage": "https://www.drupal.org/user/2919723" + }, { "name": "slashrsm", "homepage": "https://www.drupal.org/user/744628" @@ -8004,7 +8008,7 @@ { "name": "drupal/twitter_block", "version": "3.0.0-alpha0", - "version_normalized": "3.0.0.0-alpha", + "version_normalized": "3.0.0.0-alpha0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/twitter_block.git", @@ -8017,13 +8021,10 @@ "shasum": "f959bec1332f2bd45e813eefa3b982df4eb129bb" }, "require": { - "drupal/core": "*" + "drupal/core": "^8" }, "type": "drupal-module", "extra": { - "branch-alias": { - "dev-3.x": "3.x-dev" - }, "drupal": { "version": "8.x-3.0-alpha0", "datestamp": "1489574283", @@ -8063,7 +8064,7 @@ "description": "Provides configurable blocks for a Twitter feed.", "homepage": "http://drupal.org/project/twitter_block", "support": { - "source": "http://cgit.drupalcode.org/twitter_block" + "source": "https://git.drupalcode.org/project/twitter_block" } }, { @@ -9093,12 +9094,12 @@ "version_normalized": "0.9.1.0", "source": { "type": "git", - "url": "https://github.com/njh/easyrdf.git", + "url": "https://github.com/easyrdf/easyrdf.git", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/njh/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", + "url": "https://api.github.com/repos/easyrdf/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566", "shasum": "" }, @@ -12990,7 +12991,8 @@ "keywords": [ "i18n", "text" - ] + ], + "abandoned": true }, { "name": "twig/twig", diff --git a/web/modules/dropzonejs/.editorconfig b/web/modules/dropzonejs/.editorconfig new file mode 100644 index 0000000000..7fc6757614 --- /dev/null +++ b/web/modules/dropzonejs/.editorconfig @@ -0,0 +1,5 @@ +# @see http://editorconfig.org/ + +[composer.libraries.json] +indent_size = 4 +indent_style = space diff --git a/web/modules/dropzonejs/README.md b/web/modules/dropzonejs/README.md index 1bc517ef79..7af1a12dc5 100644 --- a/web/modules/dropzonejs/README.md +++ b/web/modules/dropzonejs/README.md @@ -1,35 +1,82 @@ -## About DropzoneJS +# About DropzoneJS -This is the Drupal 8 integration for [DropzoneJS](http://www.dropzonejs.com/). +This is the Drupal integration for [DropzoneJS](http://www.dropzonejs.com/). + +### How to install + +#### The non-composer way -###How to install: 1. Download this module 2. [Download DropzoneJS](https://github.com/enyo/dropzone) and place it in the libraries folder -3. Install dropzonejs the [usual way](https://www.drupal.org/documentation/install/modules-themes/modules-8) +3. Install dropzonejs the [usual way](https://www.drupal.org/docs/extending-drupal/installing-drupal-modules) 4. Remove "test" folder from libraries folder as it could constitute a security risk to your site. See http://drupal.org/node/1189632 for more info. You will now have a dropzonejs element at your disposal. -###Future plans: +#### The composer way 1 + +Run `composer require wikimedia/composer-merge-plugin` + +Update the root `composer.json` file. For example: + +``` + "extra": { + "merge-plugin": { + "include": [ + "web/modules/contrib/dropzonejs/composer.libraries.json" + ] + } + } +``` + +Run `composer require drupal/dropzonejs enyo/dropzone`, the DropzoneJS library will be +installed to the `libraries` folder automatically. + +#### The composer way 2 + +Copy the following into the root `composer.json` file's `repository` key + +``` + "repositories": [ + { + "type": "package", + "package": { + "name": "enyo/dropzone", + "version": "5.7.1", + "type": "drupal-library", + "dist": { + "url": "https://github.com/enyo/dropzone/archive/v5.7.1.zip", + "type": "zip" + } + } + } + ] +``` + +Run `composer require drupal/dropzonejs enyo/dropzone`, the DropzoneJS library +will be installed to the `libraries` folder automatically as well. + +### Future plans: - A dropzonejs field widget. - Handling already uploaded files. - Handling other types of upload validations (min/max resolution, min size,...) - Removing files that were removed by the user on first upload from temp storage. -###Project page: +### Project page: [drupal.org project page](https://www.drupal.org/project/dropzonejs) -###Maintainers: +### Maintainers: + Janez Urevc (@slashrsm) drupal.org/u/slashrsm + John McCormick (@neardark) drupal.org/u/neardark + Primoz Hmeljak (@primsi) drupal.org/u/Primsi ++ Qiangjun Ran (@jungle) drupal.org/u/jungle -###Get in touch: +### Get in touch: - http://groups.drupal.org/media - - IRC: #drupal-media @ Freenode - -###Thanks: + - **#media**: http://drupal.slack.com + +### Thanks: The development of this module is sponsored by [Examiner.com](http://www.examiner.com) Thanks also to [NYC CAMP](http://nyccamp.org/) that hosted media sprints. diff --git a/web/modules/dropzonejs/composer.json b/web/modules/dropzonejs/composer.json index 975a82d2dc..36025f3af3 100644 --- a/web/modules/dropzonejs/composer.json +++ b/web/modules/dropzonejs/composer.json @@ -1,41 +1,49 @@ { - "name": "drupal/dropzonejs", - "description": "Drupal integration for DropzoneJS - An open source library that provides drag’n’drop file uploads with image previews.", - "type": "drupal-module", - "homepage": "https://www.drupal.org/project/dropzonejs", - "keywords": ["Drupal", "DropzoneJS"], - "license": "GPL-2.0+", - "minimum-stability": "dev", - "prefer-stable": true, - "support": { - "issues": "https://www.drupal.org/project/issues/dropzonejs", - "irc": "irc://irc.freenode.org/drupal-contribute", - "source": "https://www.drupal.org/project/dropzonejs" - }, - "authors": [ - { - "name": "Janez Urevc", - "homepage": "https://drupal.org/u/slashrsm", - "role": "Maintainer" + "name": "drupal/dropzonejs", + "description": "Drupal integration for DropzoneJS - An open source library that provides drag’n’drop file uploads with image previews.", + "type": "drupal-module", + "homepage": "https://www.drupal.org/project/dropzonejs", + "keywords": ["Drupal", "DropzoneJS"], + "license": "GPL-2.0-or-later", + "minimum-stability": "dev", + "prefer-stable": true, + "support": { + "issues": "https://www.drupal.org/project/issues/dropzonejs", + "#media": "http://drupal.slack.com", + "source": "https://www.drupal.org/project/dropzonejs" }, - { - "name": "Christian Fritsch", - "homepage": "https://drupal.org/u/chrfritsch", - "role": "Maintainer" + "authors": [ + { + "name": "Janez Urevc", + "homepage": "https://drupal.org/u/slashrsm", + "role": "Maintainer" + }, + { + "name": "Christian Fritsch", + "homepage": "https://drupal.org/u/chrfritsch", + "role": "Maintainer" + }, + { + "name": "Primoz Hmeljak", + "homepage": "https://drupal.org/u/Primsi", + "role": "Maintainer" + }, + { + "name": "Qiangjun Ran", + "homepage": "https://drupal.org/u/jungle", + "role": "Maintainer" + }, + { + "name": "See other contributors", + "homepage": "https://www.drupal.org/node/1998478/committers", + "role": "contributor" + } + ], + "require": {}, + "require-dev": { + "drupal/entity_browser": "^2.5" }, - { - "name": "Primoz Hmeljak", - "homepage": "https://drupal.org/u/Primsi", - "role": "Maintainer" - }, - { - "name": "See other contributors", - "homepage": "https://www.drupal.org/node/1998478/committers", - "role": "contributor" + "suggest": { + "enyo/dropzone": "Required to use drupal/dropzonejs. DropzoneJS is an open source library that provides drag’n’drop file uploads with image previews." } - ], - "require": {}, - "suggest": { - "enyo/dropzone": "Required to user drupal/dropzonejs. Dropzone is an easy to use drag'n'drop library." - } } diff --git a/web/modules/dropzonejs/composer.libraries.json b/web/modules/dropzonejs/composer.libraries.json new file mode 100644 index 0000000000..7f82b5e1d0 --- /dev/null +++ b/web/modules/dropzonejs/composer.libraries.json @@ -0,0 +1,19 @@ +{ + "repositories": { + "enyo/dropzone": { + "type": "package", + "package": { + "name": "enyo/dropzone", + "version": "5.7.1", + "type": "drupal-library", + "dist": { + "url": "https://github.com/enyo/dropzone/archive/v5.7.1.zip", + "type": "zip" + } + } + } + }, + "require": { + "enyo/dropzone": "5.7.1" + } +} diff --git a/web/modules/dropzonejs/config/install/dropzonejs.settings.yml b/web/modules/dropzonejs/config/install/dropzonejs.settings.yml index 940ac0d681..5a2b111f04 100644 --- a/web/modules/dropzonejs/config/install/dropzonejs.settings.yml +++ b/web/modules/dropzonejs/config/install/dropzonejs.settings.yml @@ -1,2 +1,3 @@ tmp_upload_scheme: temporary filename_transliteration: true +upload_timeout_ms: 0 diff --git a/web/modules/dropzonejs/config/schema/dropzonejs.schema.yml b/web/modules/dropzonejs/config/schema/dropzonejs.schema.yml index ab75420398..587ccae177 100644 --- a/web/modules/dropzonejs/config/schema/dropzonejs.schema.yml +++ b/web/modules/dropzonejs/config/schema/dropzonejs.schema.yml @@ -8,3 +8,6 @@ dropzonejs.settings: filename_transliteration: type: boolean label: 'Transliterate names of uploaded files' + upload_timeout_ms: + type: integer + label: 'Upload timeout' diff --git a/web/modules/dropzonejs/dropzonejs.info.yml b/web/modules/dropzonejs/dropzonejs.info.yml index e246dac93d..25f528f959 100644 --- a/web/modules/dropzonejs/dropzonejs.info.yml +++ b/web/modules/dropzonejs/dropzonejs.info.yml @@ -6,7 +6,7 @@ package: Media dependencies: - drupal:file -# Information added by Drupal.org packaging script on 2020-03-31 -version: '8.x-2.1' +# Information added by Drupal.org packaging script on 2020-09-17 +version: '8.x-2.3' project: 'dropzonejs' -datestamp: 1585662326 +datestamp: 1600310563 diff --git a/web/modules/dropzonejs/dropzonejs.install b/web/modules/dropzonejs/dropzonejs.install index 679b46c941..17f9f8839d 100644 --- a/web/modules/dropzonejs/dropzonejs.install +++ b/web/modules/dropzonejs/dropzonejs.install @@ -72,3 +72,14 @@ function dropzonejs_update_8002() { $config->set('filename_transliteration', TRUE); $config->save(TRUE); } + +/** + * Set default value for upload timeout. + */ +function dropzonejs_update_8003() { + $config_factory = \Drupal::configFactory(); + $config = $config_factory->getEditable('dropzonejs.settings'); + $config->clear('upload_timeout_ms'); + $config->set('upload_timeout_ms', 0); + $config->save(TRUE); +} diff --git a/web/modules/dropzonejs/modules/eb_widget/dropzonejs_eb_widget.info.yml b/web/modules/dropzonejs/modules/eb_widget/dropzonejs_eb_widget.info.yml index c691dda5ff..f803a34dc8 100644 --- a/web/modules/dropzonejs/modules/eb_widget/dropzonejs_eb_widget.info.yml +++ b/web/modules/dropzonejs/modules/eb_widget/dropzonejs_eb_widget.info.yml @@ -9,7 +9,7 @@ dependencies: - entity_browser:entity_browser -# Information added by Drupal.org packaging script on 2020-03-31 -version: '8.x-2.1' +# Information added by Drupal.org packaging script on 2020-09-17 +version: '8.x-2.3' project: 'dropzonejs' -datestamp: 1585662326 +datestamp: 1600310563 diff --git a/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php b/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php index 1b4b49b791..0c18472d48 100644 --- a/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php +++ b/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php @@ -603,4 +603,18 @@ public static function handleAjaxCommand(array $form, FormStateInterface $form_s return $ajax; } + /** + * {@inheritdoc} + */ + protected function handleWidgetContext($widget_context) { + parent::handleWidgetContext($widget_context); + $validators = isset($widget_context['upload_validators']) ? $widget_context['upload_validators'] : []; + if (isset($validators['file_validate_size'])) { + $this->configuration['max_filesize'] = $validators['file_validate_size'][0]; + } + if (isset($validators['file_validate_extensions'])) { + $this->configuration['extensions'] = $validators['file_validate_extensions'][0]; + } + } + } diff --git a/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php b/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php index 34a12b09d0..c50c568992 100644 --- a/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php +++ b/web/modules/dropzonejs/modules/eb_widget/src/Plugin/EntityBrowser/Widget/MediaEntityDropzoneJsEbWidget.php @@ -104,6 +104,11 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ]); } + // Remove these config options as these are propagated from the field. + $form['max_filesize']['#access'] = FALSE; + $form['extensions']['#access'] = FALSE; + $form['upload_location']['#access'] = FALSE; + return $form; } @@ -167,4 +172,18 @@ public function submit(array &$element, array &$form, FormStateInterface $form_s $this->clearFormValues($element, $form_state); } + /** + * {@inheritdoc} + */ + protected function handleWidgetContext($widget_context) { + parent::handleWidgetContext($widget_context); + $bundle = $this->getType(); + $source = $bundle->getSource(); + $field = $source->getSourceFieldDefinition($bundle); + $field_storage = $field->getFieldStorageDefinition(); + $this->configuration['upload_location'] = $field_storage->getSettings()['uri_scheme'] . '://' . $field->getSettings()['file_directory']; + $this->configuration['max_filesize'] = $field->getSettings()['max_filesize']; + $this->configuration['extensions'] = $field->getSettings()['file_extensions']; + } + } diff --git a/web/modules/dropzonejs/src/Controller/UploadController.php b/web/modules/dropzonejs/src/Controller/UploadController.php index fb08090c04..6e9b588def 100644 --- a/web/modules/dropzonejs/src/Controller/UploadController.php +++ b/web/modules/dropzonejs/src/Controller/UploadController.php @@ -55,7 +55,7 @@ public static function create(ContainerInterface $container) { } /** - * Handles DropzoneJs uploads. + * Handles DropzoneJS uploads. */ public function handleUploads() { $file = $this->request->files->get('file'); @@ -65,10 +65,12 @@ public function handleUploads() { // @todo: Implement file_validate_size(); try { + /* @var \Drupal\Core\File\FileSystem $file_system */ + $file_system = \Drupal::service('file_system'); // Return JSON-RPC response. return new AjaxResponse([ 'jsonrpc' => '2.0', - 'result' => basename($this->uploadHandler->handleUpload($file)), + 'result' => $file_system->basename($this->uploadHandler->handleUpload($file)), 'id' => 'id', ]); } diff --git a/web/modules/dropzonejs/src/DropzoneJsUploadSaveInterface.php b/web/modules/dropzonejs/src/DropzoneJsUploadSaveInterface.php index 9d5672c0fe..2a1f1a7c1c 100644 --- a/web/modules/dropzonejs/src/DropzoneJsUploadSaveInterface.php +++ b/web/modules/dropzonejs/src/DropzoneJsUploadSaveInterface.php @@ -6,7 +6,7 @@ use Drupal\file\FileInterface; /** - * Provides an interface for classes that save DropzoneJs uploads. + * Provides an interface for classes that save DropzoneJS uploads. */ interface DropzoneJsUploadSaveInterface { diff --git a/web/modules/dropzonejs/src/Element/DropzoneJs.php b/web/modules/dropzonejs/src/Element/DropzoneJs.php index 11aedb1c3b..48d24c3c4e 100644 --- a/web/modules/dropzonejs/src/Element/DropzoneJs.php +++ b/web/modules/dropzonejs/src/Element/DropzoneJs.php @@ -23,7 +23,7 @@ * Will be visible inside the upload area. * - #max_filesize (string) * Used by dropzonejs and expressed in number + unit (i.e. 1.1M) This will be - * converted to a form that DropzoneJs understands. See: + * converted to a form that DropzoneJS understands. See: * http://www.dropzonejs.com/#config-maxFilesize * - #extensions (string) * A string of valid extensions separated by a space. @@ -138,6 +138,7 @@ public static function preRenderDropzoneJs(array $element) { 'dictDefaultMessage' => Html::escape($element['#dropzone_description']), 'acceptedFiles' => '.' . str_replace(' ', ',.', self::getValidExtensions($element)), 'maxFiles' => $element['#max_files'], + 'timeout' => \Drupal::configFactory()->get('dropzonejs.settings')->get('upload_timeout_ms'), ], ], ]; diff --git a/web/modules/dropzonejs/tests/modules/dropzonejs_test/dropzonejs_test.info.yml b/web/modules/dropzonejs/tests/modules/dropzonejs_test/dropzonejs_test.info.yml index ba9f5b3259..ebe917b302 100644 --- a/web/modules/dropzonejs/tests/modules/dropzonejs_test/dropzonejs_test.info.yml +++ b/web/modules/dropzonejs/tests/modules/dropzonejs_test/dropzonejs_test.info.yml @@ -1,6 +1,7 @@ -name: 'DropzoneJs Test' +name: 'DropzoneJS Test' type: module -description: 'Support module for DropzoneJs tests.' +description: 'Support module for DropzoneJS tests.' +core_version_requirement: ^8.8 || ^9 package: Testing # version: VERSION dependencies: @@ -8,7 +9,7 @@ dependencies: - dropzonejs:dropzonejs - dropzonejs:dropzonejs_eb_widget -# Information added by Drupal.org packaging script on 2020-03-31 -version: '8.x-2.1' +# Information added by Drupal.org packaging script on 2020-09-17 +version: '8.x-2.3' project: 'dropzonejs' -datestamp: 1585662326 +datestamp: 1600310563 diff --git a/web/modules/dropzonejs/tests/modules/dropzonejs_test/src/Form/DropzoneJsTestForm.php b/web/modules/dropzonejs/tests/modules/dropzonejs_test/src/Form/DropzoneJsTestForm.php index 841d6b718b..867f9c8a59 100644 --- a/web/modules/dropzonejs/tests/modules/dropzonejs_test/src/Form/DropzoneJsTestForm.php +++ b/web/modules/dropzonejs/tests/modules/dropzonejs_test/src/Form/DropzoneJsTestForm.php @@ -22,10 +22,10 @@ public function getFormId() { */ public function buildForm(array $form, FormStateInterface $form_state) { $form['dropzonejs'] = [ - '#title' => $this->t('DropzoneJs element'), + '#title' => $this->t('DropzoneJS element'), '#type' => 'dropzonejs', '#required' => TRUE, - '#dropzone_description' => 'DropzoneJs description', + '#dropzone_description' => 'DropzoneJS description', '#max_filesize' => '1M', '#extensions' => 'jpg png', ]; diff --git a/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsElementTest.php b/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsElementTest.php index 7a8e55482c..98ac71d2a6 100644 --- a/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsElementTest.php +++ b/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsElementTest.php @@ -7,9 +7,9 @@ use Drupal\user\RoleInterface; /** - * Tests related to the dropzoneJs element. + * Tests related to the DropzoneJS element. * - * @group DropzoneJs + * @group dropzonejs */ class DropzoneJsElementTest extends KernelTestBase { @@ -49,8 +49,8 @@ public function testDropzoneJsElement() { $xpath_base = "//div[contains(@class, 'form-item-dropzonejs')]"; // Label. - $this->assertEmpty($this->xpath("$xpath_base/label[text()='Not DropzoneJs element']")); - $this->assertNotEmpty($this->xpath("$xpath_base/label[text()='DropzoneJs element']")); + $this->assertEmpty($this->xpath("$xpath_base/label[text()='Not DropzoneJS element']")); + $this->assertNotEmpty($this->xpath("$xpath_base/label[text()='DropzoneJS element']")); // Element where dropzonejs is attached to. $this->assertNotEmpty($this->xpath("$xpath_base/div[contains(@class, 'dropzone-enable')]")); // Uploaded files input. diff --git a/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsUploadControllerTest.php b/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsUploadControllerTest.php index f1bc6bc5a4..27cf67eab3 100644 --- a/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsUploadControllerTest.php +++ b/web/modules/dropzonejs/tests/src/Kernel/DropzoneJsUploadControllerTest.php @@ -11,9 +11,9 @@ use Drupal\language\Entity\ConfigurableLanguage; /** - * Tests dropzoneJs upload controller. + * Tests DropzoneJS upload controller. * - * @group DropzoneJs + * @group dropzonejs */ class DropzoneJsUploadControllerTest extends KernelTestBase { @@ -43,7 +43,7 @@ class DropzoneJsUploadControllerTest extends KernelTestBase { * * @var string */ - protected $testfileData = 'DropzoneJs test file data'; + protected $testfileData = 'DropzoneJS test file data'; /** * Modules to enable. @@ -68,7 +68,7 @@ protected function setUp() { } /** - * Test that dropzoneJs correctly handles uploads. + * Test that DropzoneJS correctly handles uploads. */ public function testDropzoneJsUploadController() { $this->container->get('router.builder')->rebuild(); @@ -99,7 +99,7 @@ public function testDropzoneJsUploadController() { } /** - * Tests that dropzoneJs ignores filename transliteration. + * Tests that DropzoneJS ignores filename transliteration. */ public function testIgnoreTransliteration() { $this->container->get('router.builder')->rebuild(); -- GitLab