annotate modules/profile/profile.install @ 20:e3d20ebd63d1 tip

Added tag 6.9 for changeset 3edae6ecd6c6
author Franck Deroche <franck@defr.org>
date Thu, 15 Jan 2009 10:16:10 +0100
parents 3edae6ecd6c6
children
rev   line source
webmaster@1 1 <?php
franck@19 2 // $Id: profile.install,v 1.12.2.1 2009/01/06 15:46:37 goba Exp $
webmaster@1 3
webmaster@1 4 /**
webmaster@1 5 * Implementation of hook_install().
webmaster@1 6 */
webmaster@1 7 function profile_install() {
webmaster@1 8 // Create tables.
webmaster@1 9 drupal_install_schema('profile');
webmaster@1 10 }
webmaster@1 11
webmaster@1 12 /**
webmaster@1 13 * Implementation of hook_uninstall().
webmaster@1 14 */
webmaster@1 15 function profile_uninstall() {
webmaster@1 16 // Remove tables
webmaster@1 17 drupal_uninstall_schema('profile');
webmaster@1 18
webmaster@1 19 variable_del('profile_block_author_fields');
webmaster@1 20 }
webmaster@1 21
webmaster@1 22 /**
webmaster@1 23 * Implementation of hook_schema().
webmaster@1 24 */
webmaster@1 25 function profile_schema() {
webmaster@1 26 $schema['profile_fields'] = array(
franck@19 27 'description' => 'Stores profile field information.',
webmaster@1 28 'fields' => array(
webmaster@1 29 'fid' => array(
webmaster@1 30 'type' => 'serial',
webmaster@1 31 'not null' => TRUE,
franck@19 32 'description' => 'Primary Key: Unique profile field ID.',
webmaster@1 33 ),
webmaster@1 34 'title' => array(
webmaster@1 35 'type' => 'varchar',
webmaster@1 36 'length' => 255,
webmaster@1 37 'not null' => FALSE,
franck@19 38 'description' => 'Title of the field shown to the end user.',
webmaster@1 39 ),
webmaster@1 40 'name' => array(
webmaster@1 41 'type' => 'varchar',
webmaster@1 42 'length' => 128,
webmaster@1 43 'not null' => TRUE,
webmaster@1 44 'default' => '',
franck@19 45 'description' => 'Internal name of the field used in the form HTML and URLs.',
webmaster@1 46 ),
webmaster@1 47 'explanation' => array(
webmaster@1 48 'type' => 'text',
webmaster@1 49 'not null' => FALSE,
franck@19 50 'description' => 'Explanation of the field to end users.',
webmaster@1 51 ),
webmaster@1 52 'category' => array(
webmaster@1 53 'type' => 'varchar',
webmaster@1 54 'length' => 255,
webmaster@1 55 'not null' => FALSE,
franck@19 56 'description' => 'Profile category that the field will be grouped under.',
webmaster@1 57 ),
webmaster@1 58 'page' => array(
webmaster@1 59 'type' => 'varchar',
webmaster@1 60 'length' => 255,
webmaster@1 61 'not null' => FALSE,
franck@19 62 'description' => "Title of page used for browsing by the field's value",
webmaster@1 63 ),
webmaster@1 64 'type' => array(
webmaster@1 65 'type' => 'varchar',
webmaster@1 66 'length' => 128,
webmaster@1 67 'not null' => FALSE,
franck@19 68 'description' => 'Type of form field.',
webmaster@1 69 ),
webmaster@1 70 'weight' => array(
webmaster@1 71 'type' => 'int',
webmaster@1 72 'not null' => TRUE,
webmaster@1 73 'default' => 0,
webmaster@1 74 'size' => 'tiny',
franck@19 75 'description' => 'Weight of field in relation to other profile fields.',
webmaster@1 76 ),
webmaster@1 77 'required' => array(
webmaster@1 78 'type' => 'int',
webmaster@1 79 'not null' => TRUE,
webmaster@1 80 'default' => 0,
webmaster@1 81 'size' => 'tiny',
franck@19 82 'description' => 'Whether the user is required to enter a value. (0 = no, 1 = yes)',
webmaster@1 83 ),
webmaster@1 84 'register' => array(
webmaster@1 85 'type' => 'int',
webmaster@1 86 'not null' => TRUE,
webmaster@1 87 'default' => 0,
webmaster@1 88 'size' => 'tiny',
franck@19 89 'description' => 'Whether the field is visible in the user registration form. (1 = yes, 0 = no)',
webmaster@1 90 ),
webmaster@1 91 'visibility' => array(
webmaster@1 92 'type' => 'int',
webmaster@1 93 'not null' => TRUE,
webmaster@1 94 'default' => 0,
webmaster@1 95 'size' => 'tiny',
franck@19 96 'description' => 'The level of visibility for the field. (0 = hidden, 1 = private, 2 = public on profile but not member list pages, 3 = public on profile and list pages)',
webmaster@1 97 ),
webmaster@1 98 'autocomplete' => array(
webmaster@1 99 'type' => 'int',
webmaster@1 100 'not null' => TRUE,
webmaster@1 101 'default' => 0,
webmaster@1 102 'size' => 'tiny',
franck@19 103 'description' => 'Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)',
webmaster@1 104 ),
webmaster@1 105 'options' => array(
webmaster@1 106 'type' => 'text',
webmaster@1 107 'not null' => FALSE,
franck@19 108 'description' => 'List of options to be used in a list selection field.',
webmaster@1 109 ),
webmaster@1 110 ),
webmaster@1 111 'indexes' => array('category' => array('category')),
webmaster@1 112 'unique keys' => array('name' => array('name')),
webmaster@1 113 'primary key' => array('fid'),
webmaster@1 114 );
webmaster@1 115
webmaster@1 116 $schema['profile_values'] = array(
franck@19 117 'description' => 'Stores values for profile fields.',
webmaster@1 118 'fields' => array(
webmaster@1 119 'fid' => array(
webmaster@1 120 'type' => 'int',
webmaster@1 121 'unsigned' => TRUE,
webmaster@1 122 'not null' => TRUE,
webmaster@1 123 'default' => 0,
franck@19 124 'description' => 'The {profile_fields}.fid of the field.',
webmaster@1 125 ),
webmaster@1 126 'uid' => array(
webmaster@1 127 'type' => 'int',
webmaster@1 128 'unsigned' => TRUE,
webmaster@1 129 'not null' => TRUE,
webmaster@1 130 'default' => 0,
franck@19 131 'description' => 'The {users}.uid of the profile user.',
webmaster@1 132 ),
webmaster@1 133 'value' => array(
webmaster@1 134 'type' => 'text',
webmaster@1 135 'not null' => FALSE,
franck@19 136 'description' => 'The value for the field.',
webmaster@1 137 ),
webmaster@1 138 ),
webmaster@1 139 'primary key' => array('uid', 'fid'),
webmaster@1 140 'indexes' => array(
webmaster@1 141 'fid' => array('fid'),
webmaster@1 142 ),
webmaster@1 143 );
webmaster@1 144
webmaster@1 145 return $schema;
webmaster@1 146 }
webmaster@1 147