conditional_fields.install in Conditional Fields 6
Same filename and directory in other branches
Install, update and uninstall functions for the Conditional Fields module.
File
conditional_fields.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Conditional Fields module.
*/
/**
* Implementation of hook_install().
*/
function conditional_fields_install() {
drupal_install_schema('conditional_fields');
// Increase module weight to 10, over fieldgroup.module which has 9.
db_query("UPDATE {system} SET weight = 10 WHERE name = 'conditional_fields'");
$t = get_t();
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',
)),
)));
}
function conditional_fields_schema() {
$schema['conditional_fields'] = array(
'fields' => array(
'control_field_name' => array(
'type' => 'varchar',
'length' => '32',
'not null' => TRUE,
'default' => '',
),
'field_name' => array(
'type' => 'varchar',
'length' => '32',
'not null' => TRUE,
'default' => '',
),
'type' => array(
'type' => 'varchar',
'length' => '127',
'not null' => TRUE,
'default' => '',
),
'trigger_values' => array(
'type' => 'text',
'size' => 'medium',
'not null' => TRUE,
),
),
);
return $schema;
}
/**
* Implementation of hook_uninstall().
*/
function conditional_fields_uninstall() {
drupal_uninstall_schema('conditional_fields');
// Delete all the conditional fields variables and then clear the variable cache
db_query("DELETE FROM {variable} WHERE name LIKE 'c_fields_%'");
cache_clear_all('variables', 'cache');
}
Functions
Name | Description |
---|---|
conditional_fields_install | Implementation of hook_install(). |
conditional_fields_schema | |
conditional_fields_uninstall | Implementation of hook_uninstall(). |