| Commit | Line | Data |
|---|---|---|
| c573bbbd | 1 | <?php |
| c573bbbd KS |
2 | /** |
| 3 | * Implementation of hook_install(). | |
| 4 | */ | |
| 5 | function cck_install() { | |
| a8397343 | 6 | |
| c573bbbd KS |
7 | } |
| 8 | ||
| c573bbbd KS |
9 | /** |
| 10 | * Implementation of hook_uninstall(). | |
| 11 | */ | |
| 12 | function cck_uninstall() { | |
| c573bbbd KS |
13 | db_query("DELETE FROM {variable} WHERE name LIKE 'cck_extra_weights_%'"); |
| 14 | } | |
| 15 | ||
| 16 | /** | |
| 17 | * Implementation of hook_schema. | |
| 18 | * | |
| 19 | * Create a table to hold data for field settings CCK is managing, | |
| 20 | * like custom PHP code for Allowed values and default values that we | |
| 21 | * don't want in core. | |
| 22 | */ | |
| 23 | function cck_schema() { | |
| a8397343 | 24 | |
| c573bbbd KS |
25 | $schema['cck_field_settings'] = array( |
| 26 | 'fields' => array( | |
| 27 | 'field_name' => array( | |
| 28 | 'type' => 'varchar', | |
| 29 | 'length' => 32, | |
| 30 | 'not null' => TRUE, | |
| 31 | 'description' => 'The name of the field.', | |
| 32 | ), | |
| a8397343 KS |
33 | 'entity_type' => array( |
| 34 | 'type' => 'varchar', | |
| 35 | 'length' => 32, | |
| 36 | 'not null' => TRUE, | |
| b338b91f KS |
37 | 'default' => '', |
| 38 | 'description' => 'The name of the entity type, NULL for field settings.', | |
| a8397343 | 39 | ), |
| c573bbbd KS |
40 | 'bundle' => array( |
| 41 | 'type' => 'varchar', | |
| 42 | 'length' => 32, | |
| 43 | 'not null' => FALSE, | |
| 44 | 'description' => 'The name of the bundle, NULL for field settings.', | |
| 45 | ), | |
| b338b91f KS |
46 | 'language' => array( |
| 47 | 'type' => 'varchar', | |
| 48 | 'length' => 32, | |
| 49 | 'not null' => FALSE, | |
| 50 | 'description' => 'The name of the language, NULL for field settings.', | |
| 51 | ), | |
| c573bbbd KS |
52 | 'setting_type' => array( |
| 53 | 'type' => 'varchar', | |
| 54 | 'length' => 32, | |
| 55 | 'not null' => TRUE, | |
| 56 | 'description' => 'The type of setting that CCK is managing (field, instance, widget, display).', | |
| 57 | ), | |
| 58 | 'setting' => array( | |
| 59 | 'type' => 'varchar', | |
| 60 | 'length' => 128, | |
| 61 | 'not null' => TRUE, | |
| b338b91f | 62 | 'description' => 'The name of the setting that CCK is managing (default_value_php, allowed_values_php, etc).', |
| c573bbbd KS |
63 | ), |
| 64 | 'setting_option' => array( | |
| 65 | 'type' => 'text', | |
| 66 | 'size' => 'medium', | |
| bccc8ae0 | 67 | 'not null' => FALSE, |
| c573bbbd KS |
68 | 'description' => 'The custom value for this setting.', |
| 69 | ), | |
| 70 | ), | |
| 71 | ); | |
| 72 | return $schema; | |
| 73 | } | |
| 74 | ||
| b338b91f KS |
75 | function cck_update_7000() { |
| 76 | if (!db_field_exists('cck_field_settings', 'entity_type')) { | |
| 77 | $field = array( | |
| 78 | 'type' => 'varchar', | |
| 79 | 'length' => 32, | |
| 80 | 'not null' => TRUE, | |
| 81 | 'default' => '', | |
| 82 | 'description' => 'The name of the entity type, NULL for field settings.', | |
| 83 | ); | |
| 84 | db_add_field('cck_field_settings', 'entity_type', $field); | |
| 85 | } | |
| 86 | if (!db_field_exists('cck_field_settings', 'language')) { | |
| 87 | $field = array( | |
| 88 | 'type' => 'varchar', | |
| 89 | 'length' => 32, | |
| 90 | 'not null' => FALSE, | |
| 91 | 'description' => 'The name of the language, NULL for field settings.', | |
| 92 | ); | |
| 93 | db_add_field('cck_field_settings', 'language', $field); | |
| 94 | } | |
| 14f1667e | 95 | } |