5 * Install, update and uninstall functions for the dropzonejs module.
9 * Implements hook_requirements().
11 function dropzonejs_requirements($phase) {
15 $path = DRUPAL_ROOT . '/libraries/dropzone/dist/min/dropzone.min.js';
16 if (\Drupal::moduleHandler()->moduleExists('libraries')) {
17 $path = libraries_get_path('dropzone') . '/dist/min/dropzone.min.js';
20 // Is the library found in the root libraries path.
21 $library_found = file_exists($path);
23 // If library is not found, then look in the current profile libraries path.
24 if (!$library_found) {
25 $profile_path = drupal_get_path('profile', drupal_get_profile());
26 $profile_path .= '/libraries/dropzone/dist/min/dropzone.min.js';
27 // Is the library found in the current profile libraries path.
28 $library_found = file_exists($profile_path);
31 if (!$library_found) {
32 $requirements['dropzonejs_library'] = array(
33 'title' => t('Dropzone library missing'),
34 'description' => t('Dropzonejs requires the dropzone.min.js library.
35 Download it (https://github.com/enyo/dropzone) and place it in the
36 libraries folder (/libraries)'),
37 'severity' => REQUIREMENT_ERROR,
45 * The upload handler should use stream wrappers.
47 function dropzonejs_update_8001() {
48 $config_factory = \Drupal::configFactory();
49 $config = $config_factory->getEditable('dropzonejs.settings');
50 $config->clear('tmp_dir');
51 $config->set('tmp_upload_scheme', 'temporary');