-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy paththunder.install
More file actions
73 lines (65 loc) · 2.17 KB
/
thunder.install
File metadata and controls
73 lines (65 loc) · 2.17 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* @file
* Install, update and uninstall functions for the thunder installation profile.
*/
use Drupal\Core\Entity\EntityStorageException;
use Drupal\update_helper\UpdateLogger;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
/**
* Helper function for direct use of update helper checklist service.
*
* @param string $update_id
* Identifier of update in checklist.
* @param bool $successful
* The success or failure of update.
* Used update logger service in update hook.
*/
function _thunder_mark_update_checklist(string $update_id, bool $successful, UpdateLogger $updateLogger): void {
try {
/** @var \Drupal\update_helper_checklist\UpdateChecklist $update_checklist */
$update_checklist = \Drupal::service('update_helper_checklist.update_checklist');
if ($successful) {
$update_checklist->markUpdatesSuccessful(['thunder' => [$update_id]]);
}
else {
$update_checklist->markUpdatesFailed(['thunder' => [$update_id]]);
}
}
catch (EntityStorageException $ee) {
$updateLogger->warning(t('Unable to mark update in checklist.'));
}
catch (ServiceNotFoundException $se) {
// If service is not available, we will just ignore it.
}
}
/**
* Implements hook_update_last_removed().
*/
function thunder_update_last_removed(): int {
return 8327;
}
/**
* Add publish state and unpublish state fields to newly supported entity types.
*
* In Drupal 10.3 taxonomy terms can be moderated.
*/
function thunder_update_8328(): \Stringable|string {
if (\Drupal::moduleHandler()->moduleExists('scheduler_content_moderation_integration')) {
$output = _scheduler_content_moderation_integration_add_fields();
return $output ? implode('</li><li>', $output) : t('No update required.');
}
return t('No update required.');
}
/**
* Enable paragraphs click-to-edit on existing sites.
*/
function thunder_update_8329(): void {
if (\Drupal::moduleHandler()->moduleExists('thunder_paragraphs')) {
$config = \Drupal::configFactory()
->getEditable('thunder_paragraphs.settings');
if ($config->get('click_edit.enabled') === NULL) {
$config->set('click_edit.enabled', TRUE)->save();
}
}
}