-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideocarousel.install
75 lines (63 loc) · 1.89 KB
/
videocarousel.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
<?php
/**
* Implementation of hook_install
*/
function videocarousel_install() {
// Create story as CCK content type, contents of file come from CCK export
$filename = drupal_get_path('module','videocarousel') . "/videocarousel.cck.inc";
$content_type = file_get_contents($filename);
// Build form state
$form_state = array(
'values' => array(
'type_name' => '<create>',
'macro' => $content_type,
),
);
// content_copy is a module for importing & exporting CCK types
drupal_execute("content_copy_import_form", $form_state);
content_clear_type_cache();
}
/**
* Implementation of hook_uninstall
*/
function videocarousel_uninstall() {
// the type_name must be the type_name
// as specified in the .cck.inc file
node_type_delete('videocarousel');
menu_rebuild();
}
/**
* Implementation of hook_requirements()
*/
function videocarousel_requirements($phase) {
$requirements = array();
$t = get_t();
// an array of the dependencies
// where the array key is the module machine-readable name
// and the value is the module human-readable name
$dependencies = array(
'content' => 'Content',
'emfield' => 'EmField',
);
switch ($phase) {
case 'install':
$error = FALSE;
$value = '';
foreach ($dependencies as $dependency => $module_nice_name) {
if (!module_exists($dependency)) {
$error = TRUE;
$value .= $t($module_nice_name . " to be pre-installed; ");
$severity = REQUIREMENT_ERROR;
}
}
if ($error) {
$requirements['videocarousel'] = array(
'title' => $t('videocarousel requires: '),
'value' => $value . $t(' if the required modules are now installed, please enable this module again.'),
'severity' => $severity,
);
}
break;
}
return $requirements;
}