| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function conditional_fields_install() {
|
| 8 |
drupal_install_schema('conditional_fields');
|
| 9 |
|
| 10 |
// Increase module weight to 10, over fieldgroup.module which has 9.
|
| 11 |
db_query("UPDATE {system} SET weight = 10 WHERE name = 'conditional_fields'");
|
| 12 |
}
|
| 13 |
|
| 14 |
function conditional_fields_schema() {
|
| 15 |
$schema['conditional_fields'] = array(
|
| 16 |
'fields' => array(
|
| 17 |
'control_field_name' => array(
|
| 18 |
'type' => 'varchar',
|
| 19 |
'length' => '32',
|
| 20 |
'not null' => TRUE,
|
| 21 |
'default' => ''),
|
| 22 |
'field_name' => array(
|
| 23 |
'type' => 'varchar',
|
| 24 |
'length' => '32',
|
| 25 |
'not null' => TRUE,
|
| 26 |
'default' => ''),
|
| 27 |
'type' => array(
|
| 28 |
'type' => 'varchar',
|
| 29 |
'length' => '127',
|
| 30 |
'not null' => TRUE,
|
| 31 |
'default' => ''),
|
| 32 |
'trigger_values' => array(
|
| 33 |
'type' => 'text',
|
| 34 |
'size' => 'medium',
|
| 35 |
'not null' => TRUE)
|
| 36 |
),
|
| 37 |
);
|
| 38 |
|
| 39 |
return $schema;
|
| 40 |
}
|
| 41 |
|
| 42 |
|
| 43 |
/**
|
| 44 |
* Implementation of hook_uninstall().
|
| 45 |
*/
|
| 46 |
function conditional_fields_uninstall() {
|
| 47 |
drupal_uninstall_schema('conditional_fields');
|
| 48 |
|
| 49 |
// Delete all the conditional fields variables and then clear the variable cache
|
| 50 |
db_query("DELETE FROM {variable} WHERE name LIKE 'c_fields_%'");
|
| 51 |
cache_clear_all('variables', 'cache');
|
| 52 |
|
| 53 |
}
|