-
Notifications
You must be signed in to change notification settings - Fork 4
/
csgov.profile
59 lines (52 loc) · 1.62 KB
/
csgov.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
<?php
/**
* @file
* Enables modules and site configuration for a CSGOV site installation.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_install_tasks().
*/
function csgov_install_tasks(&$install_state) {
$tasks = [
'csgov_install_settings_form' => [
'display_name' => t('CSGOV settings'),
'type' => 'form',
'function' => 'Drupal\csgov\Installer\Form\SettingsForm',
],
];
if (!empty($install_state['parameters']['csgov_migrate'])) {
$tasks['csgov_install_migrate_batch'] = [
'display_name' => '- ' . t('Default content'),
'type' => 'batch',
];
}
return $tasks;
}
/**
* Implements hook_form_FORM_ID_alter() for install_configure_form().
*
* Allows the profile to alter the site configuration form.
*/
function csgov_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
$form['site_information']['site_name']['#default_value'] = 'CSGOV Starterkit';
$form['regional_settings']['site_default_country']['#default_value'] = 'CZ';
}
/**
* Imports default content via a batch process during installation.
*
* @param $install_state
* An array of information about the current installation state.
*
* @return array|null
* The batch definition.
*/
function csgov_install_migrate_batch(&$install_state) {
// Install dependencies of migrate scripts.
\Drupal::service('module_installer')->install(['csgov_migrate']);
// Set first migrated page as site front page.
\Drupal::configFactory()->getEditable('system.site')
->set('page.front', '/node/1')->save(TRUE);
// Process migrations.
return _csgov_migrate_get_batch('import');
}