Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | <?php |
2 | ||
3 | /** | |
4 | * @file | |
5 | * Installation routines for page manager module. | |
6 | */ | |
7 | ||
8 | /** | |
9 | * Implements hook_schema(). | |
10 | */ | |
11 | function page_manager_schema() { | |
12 | // This should always point to our 'current' schema. This makes it relatively easy | |
13 | // to keep a record of schema as we make changes to it. | |
14 | return page_manager_schema_1(); | |
15 | } | |
16 | ||
17 | /** | |
18 | * Schema version 1 for Panels in D6. | |
19 | */ | |
20 | function page_manager_schema_1() { | |
21 | $schema['page_manager_handlers'] = array( | |
22 | 'export' => array( | |
23 | 'identifier' => 'handler', | |
24 | 'bulk export' => TRUE, | |
25 | 'export callback' => 'page_manager_export_task_handler', | |
26 | 'load callback' => 'page_manager_export_task_handler_load', | |
27 | 'delete callback' => 'page_manager_delete_task_handler', | |
28 | 'primary key' => 'did', | |
29 | 'api' => array( | |
30 | 'owner' => 'page_manager', | |
31 | 'api' => 'pages_default', | |
32 | 'minimum_version' => 1, | |
33 | 'current_version' => 1, | |
34 | ), | |
35 | ), | |
36 | 'fields' => array( | |
37 | 'did' => array( | |
38 | 'type' => 'serial', | |
39 | 'not null' => TRUE, | |
40 | 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.', | |
41 | 'no export' => TRUE, | |
42 | ), | |
43 | 'name' => array( | |
44 | 'type' => 'varchar', | |
45 | 'length' => '255', | |
46 | 'description' => 'Unique ID for this task handler. Used to identify it programmatically.', | |
47 | ), | |
48 | 'task' => array( | |
49 | 'type' => 'varchar', | |
50 | 'length' => '64', | |
51 | 'description' => 'ID of the task this handler is for.', | |
52 | ), | |
53 | 'subtask' => array( | |
54 | 'type' => 'varchar', | |
55 | 'length' => '64', | |
56 | 'description' => 'ID of the subtask this handler is for.', | |
57 | 'not null' => TRUE, | |
58 | 'default' => '', | |
59 | ), | |
60 | 'handler' => array( | |
61 | 'type' => 'varchar', | |
62 | 'length' => '64', | |
63 | 'description' => 'ID of the task handler being used.', | |
64 | ), | |
65 | 'weight' => array( | |
66 | 'type' => 'int', | |
67 | 'description' => 'The order in which this handler appears. Lower numbers go first.', | |
68 | ), | |
69 | 'conf' => array( | |
70 | 'type' => 'text', | |
71 | 'size' => 'big', | |
72 | 'description' => 'Serialized configuration of the handler, if needed.', | |
73 | 'not null' => TRUE, | |
74 | 'serialize' => TRUE, | |
75 | 'object default' => array(), | |
76 | ), | |
77 | ), | |
78 | 'primary key' => array('did'), | |
79 | 'unique keys' => array( | |
80 | 'name' => array('name'), | |
81 | ), | |
82 | 'indexes' => array('fulltask' => array('task', 'subtask', 'weight')), | |
83 | ); | |
84 | ||
85 | $schema['page_manager_weights'] = array( | |
86 | 'description' => 'Contains override weights for page_manager handlers that are in code.', | |
87 | 'fields' => array( | |
88 | 'name' => array( | |
89 | 'type' => 'varchar', | |
90 | 'length' => '255', | |
91 | 'description' => 'Unique ID for this task handler. Used to identify it programmatically.', | |
92 | 'not null' => TRUE, | |
93 | 'default' => '', | |
94 | ), | |
95 | 'weight' => array( | |
96 | 'type' => 'int', | |
97 | 'description' => 'The order in which this handler appears. Lower numbers go first.', | |
98 | ), | |
99 | ), | |
100 | 'primary key' => array('name'), | |
101 | 'indexes' => array( | |
102 | 'weights' => array('name', 'weight'), | |
103 | ), | |
104 | ); | |
105 | ||
106 | $schema['page_manager_pages'] = array( | |
107 | 'description' => 'Contains page subtasks for implementing pages with arbitrary tasks.', | |
108 | 'export' => array( | |
109 | 'identifier' => 'page', | |
110 | 'bulk export' => TRUE, | |
111 | 'export callback' => 'page_manager_page_export', | |
112 | 'api' => array( | |
113 | 'owner' => 'page_manager', | |
114 | 'api' => 'pages_default', | |
115 | 'minimum_version' => 1, | |
116 | 'current_version' => 1, | |
117 | ), | |
118 | ), | |
119 | 'fields' => array( | |
120 | 'pid' => array( | |
121 | 'type' => 'serial', | |
122 | 'not null' => TRUE, | |
123 | 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.', | |
124 | 'no export' => TRUE, | |
125 | ), | |
126 | 'name' => array( | |
127 | 'type' => 'varchar', | |
128 | 'length' => '255', | |
129 | 'description' => 'Unique ID for this subtask. Used to identify it programmatically.', | |
130 | ), | |
131 | 'task' => array( | |
132 | 'type' => 'varchar', | |
133 | 'length' => '64', | |
134 | 'description' => 'What type of page this is, so that we can use the same mechanism for creating tighter UIs for targeted pages.', | |
135 | 'default' => 'page', | |
136 | ), | |
137 | 'admin_title' => array( | |
138 | 'type' => 'varchar', | |
139 | 'length' => '255', | |
140 | 'description' => 'Human readable title for this page subtask.', | |
141 | ), | |
142 | 'admin_description' => array( | |
143 | 'type' => 'text', | |
144 | 'size' => 'big', | |
145 | 'description' => 'Administrative description of this item.', | |
146 | 'object default' => '', | |
147 | ), | |
148 | 'path' => array( | |
149 | 'type' => 'varchar', | |
150 | 'length' => '255', | |
151 | 'description' => 'The menu path that will invoke this task.', | |
152 | ), | |
153 | 'access' => array( | |
154 | 'type' => 'text', | |
155 | 'size' => 'big', | |
156 | 'description' => 'Access configuration for this path.', | |
157 | 'not null' => TRUE, | |
158 | 'serialize' => TRUE, | |
159 | 'object default' => array(), | |
160 | ), | |
161 | 'menu' => array( | |
162 | 'type' => 'text', | |
163 | 'size' => 'big', | |
164 | 'description' => 'Serialized configuration of Drupal menu visibility settings for this item.', | |
165 | 'not null' => TRUE, | |
166 | 'serialize' => TRUE, | |
167 | 'object default' => array(), | |
168 | ), | |
169 | 'arguments' => array( | |
170 | 'type' => 'text', | |
171 | 'size' => 'big', | |
172 | 'description' => 'Configuration of arguments for this menu item.', | |
173 | 'not null' => TRUE, | |
174 | 'serialize' => TRUE, | |
175 | 'object default' => array(), | |
176 | ), | |
177 | 'conf' => array( | |
178 | 'type' => 'text', | |
179 | 'size' => 'big', | |
180 | 'description' => 'Serialized configuration of the page, if needed.', | |
181 | 'not null' => TRUE, | |
182 | 'serialize' => TRUE, | |
183 | 'object default' => array(), | |
184 | ), | |
185 | ), | |
186 | 'primary key' => array('pid'), | |
187 | 'unique keys' => array( | |
188 | 'name' => array('name'), | |
189 | ), | |
190 | 'indexes' => array('task' => array('task')), | |
191 | ); | |
192 | ||
193 | return $schema; | |
194 | } | |
195 | ||
196 | /** | |
197 | * Implements hook_install(). | |
198 | */ | |
199 | function page_manager_install() { | |
200 | db_update('system') | |
201 | ->fields(array('weight' => 99)) | |
202 | ->condition('name', 'page_manager') | |
203 | ->execute(); | |
204 | } |