| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Manage the workflow_named_transitions table and the module weight.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_schema().
|
| 11 |
*/
|
| 12 |
function workflow_named_transitions_schema() {
|
| 13 |
$schema['workflow_named_transitions'] = array(
|
| 14 |
'fields' => array(
|
| 15 |
'tid' => array(
|
| 16 |
'type' => 'int',
|
| 17 |
'unsigned' => TRUE,
|
| 18 |
'not null' => TRUE,
|
| 19 |
'disp-width' => '10'
|
| 20 |
),
|
| 21 |
'label' => array(
|
| 22 |
'type' => 'varchar',
|
| 23 |
'length' => '255',
|
| 24 |
'not null' => TRUE
|
| 25 |
)
|
| 26 |
),
|
| 27 |
'primary key' => array('tid')
|
| 28 |
);
|
| 29 |
return $schema;
|
| 30 |
}
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Implementation of hook_install().
|
| 34 |
*
|
| 35 |
* Add the workflow_named_transitions table for storing labels for each
|
| 36 |
* workflow transition ID (tid) and set the weight to be one more than
|
| 37 |
* the workflow module to make sure this module's form alter hook executes
|
| 38 |
* after the one in the workflow module.
|
| 39 |
*/
|
| 40 |
function workflow_named_transitions_install() {
|
| 41 |
drupal_install_schema('workflow_named_transitions');
|
| 42 |
$workflow_weight = db_result(db_query_range("SELECT weight FROM {system} WHERE name = 'workflow'", 0, 1));
|
| 43 |
db_query("UPDATE {system} SET weight = %d + 1 WHERE name = 'workflow_named_transitions'", $workflow_weight);
|
| 44 |
}
|
| 45 |
|
| 46 |
/**
|
| 47 |
* Implementation of hook_uninstall().
|
| 48 |
*
|
| 49 |
* Drop the workflow_named_transitions table.
|
| 50 |
*/
|
| 51 |
function workflow_named_transitions_uninstall() {
|
| 52 |
drupal_uninstall_schema('workflow_named_transitions');
|
| 53 |
}
|