Skip to content

Commit b41eddb

Browse files
committed
Start porting the installation profile to D9.
1 parent 954e3b2 commit b41eddb

File tree

7 files changed

+68
-26
lines changed

7 files changed

+68
-26
lines changed

commerce_base.install

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
use Drupal\user\Entity\User;
9-
use Drupal\user\RoleInterface;
9+
use Drupal\shortcut\Entity\Shortcut;
1010

1111
/**
1212
* Implements hook_install().
@@ -16,34 +16,25 @@ use Drupal\user\RoleInterface;
1616
* @see system_install()
1717
*/
1818
function commerce_base_install() {
19-
// Set front page to "node".
20-
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE);
21-
22-
// Allow visitor account creation with administrative approval.
23-
$user_settings = \Drupal::configFactory()->getEditable('user.settings');
24-
$user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(TRUE);
25-
26-
// Enable default permissions for system roles.
27-
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
28-
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access comments', 'post comments', 'skip comment approval']);
29-
3019
// Assign user 1 the "administrator" role.
3120
$user = User::load(1);
3221
$user->roles[] = 'administrator';
3322
$user->save();
3423

35-
// Enable the Contact link in the footer menu.
36-
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
37-
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
38-
$menu_link_manager->updateDefinition('contact.site_page', ['enabled' => TRUE]);
39-
40-
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
41-
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['access site-wide contact form']);
42-
43-
// Allow all users to use search.
44-
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['search content']);
45-
user_role_grant_permissions(RoleInterface::AUTHENTICATED_ID, ['search content']);
46-
47-
// Enable the admin theme.
48-
\Drupal::configFactory()->getEditable('node.settings')->set('use_admin_theme', TRUE)->save(TRUE);
24+
// Populate the default shortcut set.
25+
$shortcut = Shortcut::create([
26+
'shortcut_set' => 'default',
27+
'title' => t('Add content'),
28+
'weight' => -20,
29+
'link' => ['uri' => 'internal:/node/add'],
30+
]);
31+
$shortcut->save();
32+
33+
$shortcut = Shortcut::create([
34+
'shortcut_set' => 'default',
35+
'title' => t('All content'),
36+
'weight' => -19,
37+
'link' => ['uri' => 'internal:/admin/content'],
38+
]);
39+
$shortcut->save();
4940
}

config/install/contact.form.feedback.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ recipients:
77
- admin@example.com
88
reply: ''
99
weight: 0
10+
message: 'Your message has been sent.'
11+
redirect: ''
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
definitions:
2+
contact__site_page:
3+
enabled: true
4+
menu_name: footer
5+
parent: ''
6+
weight: 0
7+
expanded: false

config/install/node.settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use_admin_theme: true

config/install/system.site.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
uuid: ''
2+
name: ''
3+
mail: ''
4+
slogan: ''
5+
page:
6+
403: ''
7+
404: ''
8+
front: /node
9+
admin_compact_mode: false
10+
weight_select_max: 100
11+
langcode: en
12+
default_langcode: en
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
langcode: en
2+
status: true
3+
dependencies: { }
4+
id: anonymous
5+
label: 'Anonymous user'
6+
weight: 0
7+
is_admin: false
8+
permissions:
9+
- 'access comments'
10+
- 'access content'
11+
- 'access site-wide contact form'
12+
- 'search content'
13+
- 'use text format restricted_html'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
langcode: en
2+
status: true
3+
dependencies: { }
4+
id: authenticated
5+
label: 'Authenticated user'
6+
weight: 1
7+
is_admin: false
8+
permissions:
9+
- 'access comments'
10+
- 'access content'
11+
- 'access shortcuts'
12+
- 'access site-wide contact form'
13+
- 'post comments'
14+
- 'search content'
15+
- 'skip comment approval'
16+
- 'use text format basic_html'

0 commit comments

Comments
 (0)