-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththunder_testing_demo.install
36 lines (29 loc) · 1.08 KB
/
thunder_testing_demo.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
<?php
/**
* @file
* Contains.
*/
use Drupal\user\Entity\Role;
/**
* Implements hook_modules_installed().
*/
function thunder_testing_demo_modules_installed($modules) {
if (in_array('thunder_testing_demo', $modules)) {
/** @var \Drupal\Core\Entity\EntityRepositoryInterface $entityRepository */
$entityRepository = \Drupal::service('entity.repository');
$node = $entityRepository->loadEntityByUuid('node', '36b2e2b2-3df0-43eb-a282-d792b0999c07');
\Drupal::configFactory()->getEditable('tour.tour.content-paragraphs')
->set('routes.0.route_params.node', $node->id())
->save();
$tour = \Drupal::configFactory()->getEditable('tour.tour.content-add');
$article_last = $tour->get('tips.article-last.body');
$article_last = str_replace('/node/7/edit', $node->toUrl('edit-form')->toString(), $article_last);
$tour->set('tips.article-last.body', $article_last)->save();
foreach (['editor', 'restricted_editor', 'seo'] as $role) {
if ($role = Role::load($role)) {
$role->grantPermission('access tour')
->save();
}
}
}
}