[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/modules/profile/ -> profile.install (source)

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


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7