-
Notifications
You must be signed in to change notification settings - Fork 2
/
cucumber.profile
114 lines (102 loc) · 3.33 KB
/
cucumber.profile
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* @file
* Site configuration for Cucumber app.webship.co site installation.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\cucumber\Form\Recipes;
use Drupal\cucumber\Form\Demos;
use Drupal\cucumber\Form\UserRoles;
/**
* Implements hook_form_FORM_ID_alter() for install_configure_form().
*
* Allows the profile to alter the site configuration form.
*/
function cucumber_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
$form['site_information']['site_name']['#default_value'] = 'Site name';
$form['site_information']['site_mail']['#default_value'] = '[email protected]';
$form['admin_account']['account']['name']['#default_value'] = 'Super Admin';
$form['admin_account']['account']['mail']['#default_value'] = '[email protected]';
}
/**
* Implements hook_form_FORM_ID_alter() for install_settings_form().
*
* Allows the profile to alter the site settings form.
*/
function cucumber_form_install_settings_form_alter(&$form, FormStateInterface $form_state) {
$form['driver']['#default_value'] = 'sqlite';
$form['settings']['sqlite']['database']['#default_value'] = '../database/cucumber.sqlite';
return $form;
}
/**
* Implements hook_install_tasks_alter().
*/
function cucumber_install_tasks_alter(&$tasks, $install_state) {
unset($tasks['install_select_language']);
unset($tasks['install_download_translation']);
}
/**
* Implements hook_install_tasks().
*/
function cucumber_install_tasks(&$install_state) {
return [
'cucumber_user_roles' => [
'display_name' => t('User Roles'),
'display' => TRUE,
'type' => 'form',
'function' => UserRoles::class,
],
'cucumber_recipes' => [
'display_name' => t('Recipes'),
'display' => TRUE,
'type' => 'form',
'function' => Recipes::class,
],
'cucumber_demos' => [
'display_name' => t('Demos'),
'display' => TRUE,
'type' => 'form',
'function' => Demos::class,
],
];
}
/**
* Implements hook_preprocess_install_page().
*/
function cucumber_preprocess_install_page(&$variables) {
// Cucumber has custom styling for the install page.
$variables['#attached']['library'][] = 'cucumber/install-page';
}
/**
* Implements hook_requirements().
*/
function cucumber_requirements($phase) {
$requirements = [];
if (!extension_loaded('yaml')) {
$requirements['php_yaml_extension'] = [
'title' => 'PHP YAML extension',
'description' => t('The PHP YAML extension is not enabled. It is recommended that you enable the PHP YAML extension for your server.'),
'severity' => REQUIREMENT_WARNING,
];
}
if ($phase === 'install') {
// Check if the SQLite database driver is available.
if (!extension_loaded('pdo_sqlite')) {
$requirements['cucumber_sqlite'] = [
'title' => t('SQLite Database Driver'),
'value' => t('Enabled'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The PDO SQLite extension is not enabled on your server. SQLite database is required for this site.'),
];
}
else {
$requirements['cucumber_sqlite'] = [
'title' => t('SQLite Database Driver'),
'value' => t('Enabled'),
'severity' => REQUIREMENT_OK,
'description' => t('The PDO SQLite extension is enabled on your server. SQLite database is available.'),
];
}
}
return $requirements;
}