-
Notifications
You must be signed in to change notification settings - Fork 35
/
create-profile.sh
executable file
·91 lines (83 loc) · 2.79 KB
/
create-profile.sh
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
ARCHIVE=$1
# Create profile directory structure.
mkdir -p $ARCHIVE/profiles/custom/acquia_cms_minimal/config/install
# Create profile info file.
infofile="$ARCHIVE/profiles/custom/acquia_cms_minimal/acquia_cms_minimal.info.yml"
touch $infofile
echo 'name: Acquia CMS Minimal
core_version_requirement: ^9.5 || ^10
type: profile
description: "An opinionated implementation of Drupal 9 for running Acquia CMS minimal starter kit."
distribution:
name: Acquia CMS
install:
theme: acquia_claro
finish_url: "/admin/tour/dashboard"
install:
- acquia_cms_search
- acquia_cms_tour
- acquia_cms_toolbar
- acquia_cms_common
themes:
- acquia_claro
- olivero' > $infofile
# Create profile file.
profilefile="$ARCHIVE/profiles/custom/acquia_cms_minimal/acquia_cms_minimal.profile"
touch $profilefile
echo "<?php
/**
* @file
* ACMS minimal profile site installation helper.
*/
use Drupal\Core\Url;
use Drupal\user\UserInterface;
/**
* Implements hook_user_login().
*/
function acquia_cms_minimal_user_login(UserInterface \$account) {
// Ignore password reset.
\$route_name = \Drupal::routeMatch()->getRouteName();
\$user = \Drupal::currentUser();
// Check for permission.
\$has_access = \$user->hasPermission('access acquia cms tour dashboard');
\$selected_starter_kit = \Drupal::state()->get('acquia_cms.starter_kit');
if (\$route_name !== 'user.reset.login') {
// Do not interfere if a destination was already set.
\$current_request = \Drupal::service('request_stack')->getCurrentRequest();
if (!\$current_request->query->get('destination')) {
if (!\$selected_starter_kit && \$has_access) {
// Default login destination to the dashboard.
\$current_request->query->set(
'destination',
Url::fromRoute('acquia_cms_tour.enabled_modules')->toString() . '?show_starter_kit_modal=TRUE'
);
}
}
}
}
/**
* Prepares variables for install page templates.
*
* Default template: install-page.html.twig.
*
* @param array \$variables
* An associative array containing:
* - content - An array of page content.
*
* @see template_preprocess_install_page()
*/
function acquia_cms_minimal_preprocess_install_page(array &\$variables) {
\$variables['drupal_core_version'] = \Drupal::VERSION;
\$variables['#attached']['library'][] = 'acquia_claro/install-page';
\$acquia_cms_path = \Drupal::service('extension.list.profile')->getPath('acquia_cms_minimal');
\$variables['install_page_logo_path'] = '/' . \$acquia_cms_path . '/acquia_cms.png';
}
" > $profilefile
# Create theme config file.
configfile="$ARCHIVE/profiles/custom/acquia_cms_minimal/config/install/system.theme.yml"
touch $configfile
echo "admin: acquia_claro
default: olivero" > $configfile
# Copy ACMS logo.
cp acquia_cms.png $ARCHIVE/profiles/custom/acquia_cms_minimal/