-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpatternkit_media_library.install
More file actions
40 lines (34 loc) · 1.57 KB
/
patternkit_media_library.install
File metadata and controls
40 lines (34 loc) · 1.57 KB
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
<?php
/**
* @file
* Functions run when the module is installed by Drupal.
*/
/**
* Implements hook_requirements().
*/
function patternkit_media_library_requirements($phase) {
$requirements = [];
$entity_browser_installed = \Drupal::moduleHandler()->moduleExists('entity_browser');
$media_entity_browser_installed = \Drupal::moduleHandler()->moduleExists('media_entity_browser');
if (!$entity_browser_installed || !$media_entity_browser_installed) {
$requirements['patternkit_media_library_recommended_modules'] = [
'title' => t('Patternkit Media Library Recommended Modules'),
'description' => t('Patternkit Media Library recommends installing <a href="https://www.drupal.org/project/entity_browser">Entity Browser</a> and <a href="https://www.drupal.org/project/media_entity_browser">Media Entity Browser</a> for the best Media Library Experience.'),
'severity' => REQUIREMENT_INFO,
];
}
return $requirements;
}
/**
* Sets default value for new config item 'patternkit_media_library.settings'.
*/
function patternkit_media_library_update_8001(&$sandbox) {
$config_key = 'patternkit_media_library.settings';
$config_current = \Drupal::configFactory()->getEditable($config_key);
// Installs the default config only if this config is not already set.
if (is_null($config_current->get('use_styles'))) {
/** @var \Drupal\Core\Config\ConfigInstaller $config_installer_service */
$config_installer_service = \Drupal::service('config.installer');
$config_installer_service->installDefaultConfig('module', 'patternkit_media_library');
}
}