Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dropzonejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
dropzonejs
Commits
5fd2c222
Commit
5fd2c222
authored
Mar 31, 2020
by
phenaproxima
Committed by
chr.fritsch
Mar 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#3099836
by phenaproxima, Berdir: Use new LibrariesDirectoryFinder
parent
a7477cd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
13 deletions
+31
-13
dropzonejs.install
dropzonejs.install
+21
-11
dropzonejs.module
dropzonejs.module
+10
-2
No files found.
dropzonejs.install
View file @
5fd2c222
...
...
@@ -12,20 +12,30 @@ function dropzonejs_requirements($phase) {
$requirements
=
[];
$path
=
DRUPAL_ROOT
.
'/libraries/dropzone/dist/min/dropzone.min.js'
;
if
(
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'libraries'
))
{
$path
=
libraries_get_path
(
'dropzone'
)
.
'/dist/min/dropzone.min.js'
;
// @todo Remove this conditional structure in favor of using the libraries
// directory file finder service when Drupal 8.9 is the minimum supported
// version of core.
if
(
\
Drupal
::
hasService
(
'library.libraries_directory_file_finder'
))
{
/** @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder $library_file_finder */
$library_file_finder
=
\
Drupal
::
service
(
'library.libraries_directory_file_finder'
);
$library_found
=
(
bool
)
$library_file_finder
->
find
(
'dropzone/dist/min/dropzone.min.js'
);
}
else
{
$path
=
DRUPAL_ROOT
.
'/libraries/dropzone/dist/min/dropzone.min.js'
;
if
(
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'libraries'
))
{
$path
=
libraries_get_path
(
'dropzone'
)
.
'/dist/min/dropzone.min.js'
;
}
// Is the library found in the root libraries path.
$library_found
=
file_exists
(
$path
);
// Is the library found in the root libraries path.
$library_found
=
file_exists
(
$path
);
// If library is not found, then look in the current profile libraries path.
if
(
!
$library_found
)
{
$profile_path
=
drupal_get_path
(
'profile'
,
\
Drupal
::
installProfile
());
$profile_path
.
=
'/libraries/dropzone/dist/min/dropzone.min.js'
;
// Is the library found in the current profile libraries path.
$library_found
=
file_exists
(
$profile_path
);
// If library is not found, then look in the current profile libraries path.
if
(
!
$library_found
)
{
$profile_path
=
drupal_get_path
(
'profile'
,
\
Drupal
::
installProfile
());
$profile_path
.
=
'/libraries/dropzone/dist/min/dropzone.min.js'
;
// Is the library found in the current profile libraries path.
$library_found
=
file_exists
(
$profile_path
);
}
}
if
(
!
$library_found
)
{
...
...
dropzonejs.module
View file @
5fd2c222
...
...
@@ -65,14 +65,22 @@ function template_preprocess_dropzonejs(array &$variables) {
function
dropzonejs_library_info_build
()
{
$libraries
=
[];
if
(
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'libraries'
))
{
// @todo Remove this conditional structure in favor of using the libraries
// directory file finder service when Drupal 8.9 is the minimum supported
// version of core.
if
(
\
Drupal
::
hasService
(
'library.libraries_directory_file_finder'
))
{
/** @var \Drupal\Core\Asset\LibrariesDirectoryFileFinder $library_file_finder */
$library_file_finder
=
\
Drupal
::
service
(
'library.libraries_directory_file_finder'
);
$exif_path
=
$library_file_finder
->
find
(
'exif-js/exif.js'
);
}
elseif
(
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'libraries'
))
{
$exif_path
=
libraries_get_path
(
'exif-js'
)
.
'/exif.js'
;
}
else
{
$exif_path
=
DRUPAL_ROOT
.
'/libraries/exif-js/exif.js'
;
}
if
(
$exif_
found
=
file_exists
(
$exif_path
))
{
if
(
$exif_
path
&&
file_exists
(
$exif_path
))
{
$libraries
[
'exif-js'
]
=
[
'title'
=>
'Exif'
,
'website'
=>
'https://github.com/exif-js/exif-js'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment