page_manager.install 6.1 KB

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