forked from kalamuna/autogrow_textarea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautogrow_textarea.install
27 lines (24 loc) · 1.01 KB
/
autogrow_textarea.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
<?php
/**
* @file
* Install, update and uninstall functions for the Autogrow Textarea module.
*/
/**
* Implements hook_requirements().
*/
function autogrow_textarea_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$library = \Drupal::service('library.discovery')->getLibraryByName('autogrow_textarea', 'jquery_ns_autogrow');
$library_exists = file_exists(DRUPAL_ROOT . '/' . $library['js'][0]['data']);
$library_download = 'https://github.com/ro31337/jquery.ns-autogrow/archive/1.1.6.zip';
return [
'autogrow_library' => [
'title' => t('jQuery NS-Autogrow library'),
'value' => $library_exists ? t('Installed') : t('Not installed'),
'description' => $library_exists ? '' : t('The jQuery NS-Autogrow library needs to be <a href="@url">downloaded</a> and extracted into the /libraries/jquery_ns_autogrow folder in your Drupal installation directory.', ['@url' => $library_download]),
'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
],
];
}