custom_formatters.install 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the Custom Formatters module.
  5. */
  6. /**
  7. * Implements hook_schema().
  8. */
  9. function custom_formatters_schema() {
  10. $schema['formatters'] = array(
  11. 'export' => array(
  12. 'key' => 'name',
  13. 'key name' => 'Name',
  14. 'primary key' => 'name',
  15. 'identifier' => 'formatter',
  16. 'default hook' => 'custom_formatters_defaults',
  17. 'api' => array(
  18. 'owner' => 'custom_formatters',
  19. 'api' => 'custom_formatters',
  20. 'minimum_version' => 2,
  21. 'current_version' => 2,
  22. ),
  23. ),
  24. 'fields' => array(
  25. 'name' => array(
  26. 'type' => 'varchar',
  27. 'length' => 64,
  28. 'not null' => TRUE,
  29. 'default' => '',
  30. ),
  31. 'label' => array(
  32. 'type' => 'varchar',
  33. 'length' => 64,
  34. 'not null' => TRUE,
  35. 'default' => '',
  36. ),
  37. 'description' => array(
  38. 'type' => 'varchar',
  39. 'length' => 255,
  40. 'not null' => FALSE,
  41. 'default' => ''
  42. ),
  43. 'mode' => array(
  44. 'type' => 'varchar',
  45. 'length' => 32,
  46. 'not null' => TRUE,
  47. 'default' => '',
  48. ),
  49. 'field_types' => array(
  50. 'type' => 'text',
  51. 'size' => 'medium',
  52. 'not null' => TRUE,
  53. ),
  54. 'code' => array(
  55. 'type' => 'blob'
  56. ),
  57. 'fapi' => array(
  58. 'type' => 'blob'
  59. ),
  60. ),
  61. 'primary key' => array('name'),
  62. );
  63. return $schema;
  64. }
  65. /**
  66. * Implements hook_uninstall().
  67. */
  68. function custom_formatters_uninstall() {
  69. variable_del('custom_formatters_settings');
  70. }
  71. /**
  72. * Add FAPI column to Formatters table.
  73. */
  74. function custom_formatters_update_7200() {
  75. db_add_field('formatters', 'fapi', array('type' => 'blob'));
  76. return t('New FAPI column added to Formatters table.');
  77. }