forked from ruchikumari94/iitbacademic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iitbacademic.profile
92 lines (71 loc) · 3.14 KB
/
iitbacademic.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
<?php
use Drupal\Core\Form\FormStateInterface;
include_once __DIR__ . '/src/Form/IITBDistributionOptionalModulesForm.php';
/**
* @file
* Enables modules and site configuration for the Demo profile.
*/
// Add any custom code here like hook implementations.
//function iitbacademic_form_install_configure_form_alter(&$form, FormStateInterface $form_state)
function iitbacademic_install_tasks_alter(&$tasks, $install_state) {
// Replace the entire site configuration form provided by Drupal core
// with a custom callback function defined by this installation profile.
//$tasks['install_configure_form']['function'] = 'myprofile_install_configure_form';
//echo '<pre>';
//print_r($install_state);
//$tasks=array();
$tasks['i_i_t_b_distribution_optional_modules_form'] = [
'display_name' => t('Install IITB Modules'),
'type' => 'form',
'function' => 'Drupal\iitbacademic\Form\IITBDistributionOptionalModulesForm',
];
$tasks = iitbacademic_array_move('i_i_t_b_distribution_optional_modules_form',11,$tasks);
return $tasks;
}
function iitbacademic_array_splice_assoc(&$input, $offset, $length, $replacement) {
$replacement = (array) $replacement;
$key_indices = array_flip(array_keys($input));
if (isset($input[$offset]) && is_string($offset)) {
$offset = $key_indices[$offset];
}
if (isset($input[$length]) && is_string($length)) {
$length = $key_indices[$length] - $offset;
}
$input = array_slice($input, 0, $offset, TRUE)
+ $replacement
+ array_slice($input, $offset + $length, NULL, TRUE);
}
function iitbacademic_array_move($which, $where, $array) {
$tmpWhich = $which;
$j=0;
$keys = array_keys($array);
for($i=0;$i<count($array);$i++)
{
if($keys[$i]==$tmpWhich)
$tmpWhich = $j;
else
$j++;
}
$tmp = array_splice($array, $tmpWhich, 1);
iitbacademic_array_splice_assoc($array, $where, 0, $tmp);
return $array;
}
function iitbacademic_form_install_configure_form_alter(&$form, $form_state) {
//echo '<pre>';
//print_r($form);
$form['site_information']['site_name']['#default_value'] = t('IITB Academic Distribution');
$form['site_information']['site_mail']['#default_value'] = t('[email protected]');
$form['admin_account']['account']['name']['#default_value'] = t('admin');
$form['admin_account']['account']['pass']['pass1']['#default_value'] = t('admin');
$form['admin_account']['account']['pass']['pass2']['#default_value'] = t('admin');
$form['admin_account']['account']['mail']['#default_value'] = t('[email protected]');
$form['regional_settings']['site_default_country']['#default_value'] = 'IN';
$form['regional_settings']['date_default_timezone']['#default_value'] = 'Asia/Kolkata';
}
function iitbacademic_form_install_settings_form_alter(&$form, $form_state) {
//echo '<pre>';
//print_r($form);
$form['settings']['mysql']['database']['#default_value'] = 'iitbacademic';
$form['settings']['mysql']['username']['#default_value'] = 'root';
$form['settings']['mysql']['password']['#default_value'] = '123';
}