function nodeorder_install in Node Order 8
Same name and namespace in other branches
- 5 nodeorder.install \nodeorder_install()
- 6 nodeorder.install \nodeorder_install()
- 7 nodeorder.install \nodeorder_install()
Implements hook_install().
Adds field 'weight' to core table 'taxonomy_index'.
@todo: Handle exceptions that could be thrown by DatabaseSchema::addField.
File
- ./
nodeorder.install, line 15 - Nodeorder install file.
Code
function nodeorder_install() {
// Define field properties.
$spec = [
'type' => 'int',
'signed' => TRUE,
'not null' => TRUE,
'default' => 0,
'initial' => 0,
'description' => t('A user-defined weight for each node in its respective category.'),
];
// Create an index for 'weight'.
$keys['indexes'] = [
'weight' => [
'weight',
],
];
$keys['fields']['weight'] = $spec;
// Add the column to the table.
db_add_field('taxonomy_index', 'weight', $spec, $keys);
// Set the weight of the nodeorder module ensure that nodeorder can alter
// forms after the taxonomy module.
module_set_weight('nodeorder', 5);
}