This repository was archived by the owner on Sep 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtide_event.install
61 lines (54 loc) · 1.83 KB
/
tide_event.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
55
56
57
58
59
60
61
<?php
/**
* @file
* Install file.
*/
use Drupal\tide_event\TideEventOperation;
/**
* Implements hook_install().
*
* Perform actions to set up the site for Tide profile Profile.
*
* @see system_install()
*/
function tide_event_install() {
// Don't do anything else during config sync.
if (\Drupal::isConfigSyncing()) {
return;
}
TideEventOperation::addFieldsToSearchApi();
TideEventOperation::assignNecessaryPermissions(FALSE);
TideEventOperation::enableNecessaryModules();
TideEventOperation::addDefaultValueToContentCategory();
}
/**
* Implements hook_update_dependencies().
*/
function tide_event_update_dependencies() {
$dependencies = [];
$dependencies['tide_event'][10001] = ['tide_core' => 10005];
return $dependencies;
}
/**
* Implements hook_uninstall().
*/
function tide_event_uninstall() {
TideEventOperation::assignNecessaryPermissions(TRUE);
}
/**
* Imports field.field.node.event.field_content_category for existing sites.
*/
function tide_event_update_10001() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_event') . '/config/install'];
$config_read = _tide_read_config('field.field.node.event.field_content_category', $config_location, TRUE);
$storage = \Drupal::entityTypeManager()->getStorage('field_config');
$id = $storage->getIDFromConfigName('field.field.node.event.field_content_category', $storage->getEntityType()->getConfigPrefix());
if ($storage->load($id) == NULL) {
$config_entity = $storage->createFromStorageRecord($config_read);
$config_entity->save();
}
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/updates');
_tide_core_field_content_category_default_value('event', 'Event');
_tide_core_content_category_form_display('event');
}