-
Notifications
You must be signed in to change notification settings - Fork 1
/
ezybake_drupal.install
101 lines (87 loc) · 2.97 KB
/
ezybake_drupal.install
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
<?php
/**
* @file
* Ezy-bake Drupal install profile .install file.
*/
/**
* Implements hook_install().
*/
function ezybake_drupal_install() {
// Create Omega HTML 5 subtheme via Omega Tools module.
_ezybake_drupal_starterkit_omega();
// Create Zen subtheme via Zenophile module.
_ezybake_drupal_starterkit_zen();
// Create core feature from STARTERKIT module via Omega Tools module.
_ezybake_drupal_starterkit_feature();
// Disable all temporary modules.
module_disable(array('omega_tools', 'zenophile'));
// Add 'administrator' role to UID 1.
db_insert('users_roles')
->fields(array(
'uid' => 1,
'rid' => 3,
))
->execute();
}
/**
* Create Omega HTML5 subtheme.
*
* Modified version of the Omega Tools drush omega-subtheme function.
*/
function _ezybake_drupal_starterkit_omega() {
// Programatically generate theme based on sites configuration path
// (sites/[path]).
// @TODO - May need to use request_uri() instead for non-aegir based sites.
$name = preg_filter('/(sites\/)(.*?)\..*/', '$2', conf_path()) . '_omega_theme';
$subtheme = new stdClass();
$subtheme->new = TRUE;
$subtheme->name = 'Site theme - Omega';
$subtheme->machine_name = $name;
$subtheme->path = conf_path() . '/themes/' . $subtheme->machine_name;
$subtheme->base = 'omega';
$subtheme->default = TRUE;
$subtheme->status = TRUE;
omega_tools_subtheme_create($subtheme);
omega_tools_subtheme_process($subtheme);
}
/**
* Create Zen subtheme.
*
* Modified version of zenophile_callback() from
* http://drupal.org/files/zenophile.drush_.inc-1085164-11.patch.
*/
function _ezybake_drupal_starterkit_zen() {
// Programatically generate theme based on sites configuration path
// (sites/[path]).
// @TODO - May need to use request_uri() instead for non-aegir based sites.
$name = preg_filter('/(sites\/)(.*?)\..*/', '$2', conf_path()) . '_zen_theme';
$form_state = array(
'values' => array(
'sysname' => $name,
'description' => 'Site theme - Zen',
'parent' => 'STARTERKIT',
'friendly' => 'Site theme - Zen',
'layout' => 'fixed',
'fresh' => TRUE,
'site' => str_replace('sites/', '', conf_path()),
'sidebars_on' => FALSE,
'sidebar-left' => '200',
'sidebar-right' => '200',
'page' => '960',
'sidebar-pos' => 'normal',
),
);
drupal_form_submit('zenophile_create', $form_state);
}
/**
* Create core feature.
*/
function _ezybake_drupal_starterkit_feature() {
$machine_name = preg_filter('/(sites\/)(.*?)\..*/', '$2', conf_path());
$destination = conf_path() . '/modules/ezybake_drupal/' . $machine_name . '_core';
omega_tools_copy_recursive(drupal_get_path('module', 'ezybake_core') . '/STARTERKIT', $destination);
omega_tools_move($destination . '/STARTERKIT_core.info.txt', $destination . '/STARTERKIT_core.info');
omega_tools_rewrite_recursive($destination, 'STARTERKIT', $machine_name, $machine_name);
// Enable the feature.
module_enable(array($machine_name . '_core'));
}