1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Implementation of hook_schema().
|
5
|
*/
|
6
|
function panels_mini_schema() {
|
7
|
// This should always point to our 'current' schema. This makes it relatively easy
|
8
|
// to keep a record of schema as we make changes to it.
|
9
|
return panels_mini_schema_1();
|
10
|
}
|
11
|
|
12
|
/**
|
13
|
* Schema version 1 for Panels in D6.
|
14
|
*/
|
15
|
function panels_mini_schema_1() {
|
16
|
$schema = array();
|
17
|
|
18
|
$schema['panels_mini'] = array(
|
19
|
'export' => array(
|
20
|
'identifier' => 'mini',
|
21
|
'load callback' => 'panels_mini_load',
|
22
|
'load all callback' => 'panels_mini_load_all',
|
23
|
'save callback' => 'panels_mini_save',
|
24
|
'delete callback' => 'panels_mini_delete',
|
25
|
'export callback' => 'panels_mini_export',
|
26
|
'api' => array(
|
27
|
'owner' => 'panels_mini',
|
28
|
'api' => 'panels_default',
|
29
|
'minimum_version' => 1,
|
30
|
'current_version' => 1,
|
31
|
),
|
32
|
),
|
33
|
'fields' => array(
|
34
|
'pid' => array(
|
35
|
'type' => 'serial',
|
36
|
'not null' => TRUE,
|
37
|
'no export' => TRUE,
|
38
|
'description' => 'The primary key for uniqueness.',
|
39
|
),
|
40
|
'name' => array(
|
41
|
'type' => 'varchar',
|
42
|
'length' => '255',
|
43
|
'description' => 'The unique name of the mini panel.',
|
44
|
),
|
45
|
'category' => array(
|
46
|
'type' => 'varchar',
|
47
|
'length' => '64',
|
48
|
'description' => 'The category this mini panel appears in on the add content pane.',
|
49
|
),
|
50
|
'did' => array(
|
51
|
'type' => 'int',
|
52
|
'no export' => TRUE,
|
53
|
'description' => 'The display ID of the panel.',
|
54
|
),
|
55
|
'admin_title' => array(
|
56
|
'type' => 'varchar',
|
57
|
'length' => '128',
|
58
|
'description' => 'The administrative title of the mini panel.',
|
59
|
),
|
60
|
'admin_description' => array(
|
61
|
'type' => 'text',
|
62
|
'size' => 'big',
|
63
|
'description' => 'Administrative title of this mini panel.',
|
64
|
'object default' => '',
|
65
|
),
|
66
|
'requiredcontexts' => array(
|
67
|
'type' => 'text',
|
68
|
'size' => 'big',
|
69
|
'serialize' => TRUE,
|
70
|
'object default' => array(),
|
71
|
'description' => 'An array of required contexts.',
|
72
|
),
|
73
|
'contexts' => array(
|
74
|
'type' => 'text',
|
75
|
'size' => 'big',
|
76
|
'serialize' => TRUE,
|
77
|
'object default' => array(),
|
78
|
'description' => 'An array of contexts embedded into the panel.',
|
79
|
),
|
80
|
'relationships' => array(
|
81
|
'type' => 'text',
|
82
|
'size' => 'big',
|
83
|
'serialize' => TRUE,
|
84
|
'object default' => array(),
|
85
|
'description' => 'An array of relationships embedded into the panel.',
|
86
|
),
|
87
|
),
|
88
|
'primary key' => array('pid'),
|
89
|
'unique keys' => array(
|
90
|
'name' => array('name'),
|
91
|
),
|
92
|
);
|
93
|
|
94
|
return $schema;
|
95
|
}
|
96
|
|
97
|
/**
|
98
|
* Implementation of hook_uninstall().
|
99
|
*/
|
100
|
function panels_mini_uninstall() {
|
101
|
$panels_exists = db_table_exists('panels_display');
|
102
|
|
103
|
$result = db_query("SELECT * FROM {panels_mini}");
|
104
|
$deltas = array();
|
105
|
foreach ($result as $panel_mini) {
|
106
|
// Delete all associated displays.
|
107
|
if (!function_exists('panels_delete_display')) {
|
108
|
require_once drupal_get_path('module', 'panels') .'/panels.module';
|
109
|
}
|
110
|
if ($panels_exists) {
|
111
|
panels_delete_display($panel_mini->did);
|
112
|
}
|
113
|
|
114
|
$deltas[] = $panel_mini->pid;
|
115
|
}
|
116
|
|
117
|
if ($deltas) {
|
118
|
// Delete all configured blocks.
|
119
|
db_delete('block')
|
120
|
->condition('module', 'panels_mini')
|
121
|
->condition('delta', $deltas)
|
122
|
->execute();
|
123
|
}
|
124
|
}
|