This repository was archived by the owner on Jan 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdropzonejs.install
53 lines (44 loc) · 1.54 KB
/
dropzonejs.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* @file
* Install, update and uninstall functions for the dropzonejs module.
*/
/**
* Implements hook_requirements().
*/
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';
}
// 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_get_profile());
$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) {
$requirements['dropzonejs_library'] = array(
'title' => t('Dropzone library missing'),
'description' => t('Dropzonejs requires the dropzone.min.js library.
Download it (https://github.com/enyo/dropzone) and place it in the
libraries folder (/libraries)'),
'severity' => REQUIREMENT_ERROR,
);
}
return $requirements;
}
/**
* The upload handler should use stream wrappers.
*/
function dropzonejs_update_8001() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('dropzonejs.settings');
$config->clear('tmp_dir');
$config->set('tmp_upload_scheme', 'temporary');
$config->save(TRUE);
}