forked from SU-SWS/stanford_media
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stanford_media.install
54 lines (49 loc) · 1.45 KB
/
stanford_media.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
54
<?php
/**
* @file
* stanford_media.install
*/
/**
* Implements hook_install().
*/
function stanford_media_install() {
\Drupal::configFactory()->getEditable('file.settings')
->set('filename_sanitization.deduplicate_separators', TRUE)
->set('filename_sanitization.lowercase', TRUE)
->set('filename_sanitization.replace_non_alphanumeric', TRUE)
->set('filename_sanitization.replace_whitespace', TRUE)
->set('filename_sanitization.transliterate', TRUE)
->set('filename_sanitization.replacement_character', '-')
->save();
}
/**
* Uninstall transliterate_filenames module.
*/
function stanford_media_update_11000() {
if (\Drupal::moduleHandler()->moduleExists('transliterate_filenames')) {
\Drupal::service('module_installer')->uninstall([
'transliterate_filenames',
]);
}
stanford_media_install();
}
/**
* Remove filter plugin settings.
*/
function stanford_media_update_11001() {
$config_factory = \Drupal::configFactory();
foreach ($config_factory->listAll('filter.format.') as $config_name) {
$config = $config_factory->getEditable($config_name);
if ($config->get('filters.stanford_media_embed_markup')) {
$config->clear('filters.stanford_media_embed_markup')->save();
}
}
}
/**
* Check if ckeditor installed.
*/
function stanford_media_update_11002() {
if (\Drupal::moduleHandler()->moduleExists('ckeditor')) {
throw new \Exception('Stanford Media is not compatible with ckeditor');
}
}