/[drupal]/contributions/modules/conditional_fields/conditional_fields.install
ViewVC logotype

Diff of /contributions/modules/conditional_fields/conditional_fields.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.8.2.2, Thu Jun 11 00:11:19 2009 UTC revision 1.1.2.8.2.3, Thu Jul 9 16:09:53 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id$
3    /**
4     * @file
5     * Install, update and uninstall functions for the Conditional Fields module.
6     */
7    
8  /**  /**
9   * Implementation of hook_install().   * Implementation of hook_install().
10   */   */
11  function conditional_fields_install() {  function conditional_fields_install() {
12    drupal_install_schema('conditional_fields');    drupal_install_schema('conditional_fields');
13    
14    // Increase module weight to 10, over fieldgroup.module which has 9.    // Increase module weight to 10, over fieldgroup.module which has 9.
15    db_query("UPDATE {system} SET weight = 10 WHERE name = 'conditional_fields'");    db_query("UPDATE {system} SET weight = 10 WHERE name = 'conditional_fields'");
16    
17    drupal_set_message(t('Conditional Fields installed. You should now <a href="!url">give the permission</a> to administer conditional fields to the desired roles.', array('!url' => url('admin/user/permissions', array('fragment' => 'module-conditional_fields')))));    drupal_set_message(get_t('Conditional Fields installed. You should now <a href="!url">give the permission</a> to administer conditional fields to the desired roles.', array('!url' => url('admin/user/permissions', array('fragment' => 'module-conditional_fields')))));
18  }  }
19    
20  function conditional_fields_schema() {  function conditional_fields_schema() {
21    $schema['conditional_fields'] = array(    $schema['conditional_fields'] = array(
22      'fields' => array(      'fields' => array(
23        'control_field_name' => array(        'control_field_name' => array(
24          'type' => 'varchar',          'type' => 'varchar',
25          'length' => '32',          'length' => '32',
26          'not null' => TRUE,          'not null' => TRUE,
27          'default' => ''),          'default' => ''),
28        'field_name' => array(        'field_name' => array(
29          'type' => 'varchar',          'type' => 'varchar',
30          'length' => '32',          'length' => '32',
31          'not null' => TRUE,          'not null' => TRUE,
32          'default' => ''),          'default' => ''),
33        'type' => array(        'type' => array(
34          'type' => 'varchar',          'type' => 'varchar',
35          'length' => '127',          'length' => '127',
36          'not null' => TRUE,          'not null' => TRUE,
37          'default' => ''),          'default' => ''),
38        'trigger_values' => array(        'trigger_values' => array(
39          'type' => 'text',          'type' => 'text',
40          'size' => 'medium',          'size' => 'medium',
41          'not null' => TRUE)          'not null' => TRUE)
42          ),          ),
43      );      );
44    
45    return $schema;    return $schema;
46  }  }
47    
48    
49  /**  /**
50  * Implementation of hook_uninstall().   * Implementation of hook_uninstall().
51  */   */
52  function conditional_fields_uninstall() {  function conditional_fields_uninstall() {
53    drupal_uninstall_schema('conditional_fields');    drupal_uninstall_schema('conditional_fields');
54    
55    // Delete all the conditional fields variables and then clear the variable cache    // Delete all the conditional fields variables and then clear the variable cache
56    db_query("DELETE FROM {variable} WHERE name LIKE 'c_fields_%'");    db_query("DELETE FROM {variable} WHERE name LIKE 'c_fields_%'");
57    cache_clear_all('variables', 'cache');    cache_clear_all('variables', 'cache');
58    

Legend:
Removed from v.1.1.2.8.2.2  
changed lines
  Added in v.1.1.2.8.2.3

  ViewVC Help
Powered by ViewVC 1.1.2