| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
/**
|
| 4 |
* Implementation of hook_install().
|
| 5 |
*/
|
| 6 |
function cck_install() {
|
| 7 |
drupal_install_schema('cck');
|
| 8 |
}
|
| 9 |
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function cck_uninstall() {
|
| 15 |
drupal_uninstall_schema('cck');
|
| 16 |
db_query("DELETE FROM {variable} WHERE name LIKE 'cck_extra_weights_%'");
|
| 17 |
}
|
| 18 |
|
| 19 |
/**
|
| 20 |
* Implementation of hook_schema.
|
| 21 |
*
|
| 22 |
* Create a table to hold data for field settings CCK is managing,
|
| 23 |
* like custom PHP code for Allowed values and default values that we
|
| 24 |
* don't want in core.
|
| 25 |
*/
|
| 26 |
function cck_schema() {
|
| 27 |
$schema['cck_field_settings'] = array(
|
| 28 |
'fields' => array(
|
| 29 |
'field_name' => array(
|
| 30 |
'type' => 'varchar',
|
| 31 |
'length' => 32,
|
| 32 |
'not null' => TRUE,
|
| 33 |
'description' => 'The name of the field.',
|
| 34 |
),
|
| 35 |
'bundle' => array(
|
| 36 |
'type' => 'varchar',
|
| 37 |
'length' => 32,
|
| 38 |
'not null' => FALSE,
|
| 39 |
'description' => 'The name of the bundle, NULL for field settings.',
|
| 40 |
),
|
| 41 |
'setting_type' => array(
|
| 42 |
'type' => 'varchar',
|
| 43 |
'length' => 32,
|
| 44 |
'not null' => TRUE,
|
| 45 |
'description' => 'The type of setting that CCK is managing (field, instance, widget, display).',
|
| 46 |
),
|
| 47 |
'setting' => array(
|
| 48 |
'type' => 'varchar',
|
| 49 |
'length' => 128,
|
| 50 |
'not null' => TRUE,
|
| 51 |
'description' => 'The name of the setting that CCK is managing.',
|
| 52 |
),
|
| 53 |
'setting_option' => array(
|
| 54 |
'type' => 'text',
|
| 55 |
'size' => 'medium',
|
| 56 |
'not null' => FALSE,
|
| 57 |
'description' => 'The custom value for this setting.',
|
| 58 |
),
|
| 59 |
),
|
| 60 |
);
|
| 61 |
return $schema;
|
| 62 |
}
|
| 63 |
|
| 64 |
/*
|
| 65 |
// TODO need to make the following changes to update existing data:
|
| 66 |
// Set up and move to content module to handle upgrade path:
|
| 67 |
|
| 68 |
function content_update_7000() {
|
| 69 |
|
| 70 |
- Add new columns for:
|
| 71 |
- deleted: defaults to 0
|
| 72 |
- data: contains serialized array of complete $instance.
|
| 73 |
- Module-defined field settings are now at $field['settings'][...]
|
| 74 |
- Module-defined widget settings are now at $instance['widget']['settings']
|
| 75 |
- Module-defined instance settings are at $instance['settings']
|
| 76 |
- Field settings should be limited to settings that affect the schema,
|
| 77 |
all others should be instance settings.
|
| 78 |
- Display is now $instance['display'] instead of $instance['display_settings']
|
| 79 |
- Display format now adds label to every context instead of one label at the top level, for a more consistent structure.
|
| 80 |
- Rename display options, formatter names are now prefixed with field name.
|
| 81 |
- No more content type: $field['widget']['type_name'] becomes $instance['bundle']
|
| 82 |
- Required is now $instance['required'] instead of $field['required']
|
| 83 |
- Label is now $instance['label'] instead of $field['widget']['label']
|
| 84 |
- Description is now $instance['description'] instead of $field['widget']['description']
|
| 85 |
- Weight is now $instance['weight'] instead of $field['widget']['weight']
|
| 86 |
- Text module textareas are now a separate field type so the db schema won't change.
|
| 87 |
- Text module format columns are always set and don't change by field settings so the db schema won't change.
|
| 88 |
- Text and Number with allowed values are now made into List field types.
|
| 89 |
- Default values are moved out of the field settings into the cck_field_settings table maintained by CCK
|
| 90 |
}
|
| 91 |
*/
|