nodesinblock.install in Nodes In Block 6
Same filename and directory in other branches
Nodes in block install file.
File
nodesinblock.installView source
<?php
/**
* @file
* Nodes in block install file.
*/
/**
* Implementation of hook_install().
*/
function nodesinblock_install() {
drupal_install_schema('nodesinblock');
}
/**
* Implementation of hook_uninstall().
*/
function nodesinblock_uninstall() {
drupal_uninstall_schema('nodesinblock');
db_query("DELETE FROM {variable} WHERE name LIKE 'nodesinblock_%%'");
db_query("DELETE FROM {blocks} where module = 'nodesinblock'");
cache_clear_all('variables', 'cache');
}
/**
* Implementation of hook_schema().
*/
function nodesinblock_schema() {
$schema['nodesinblock'] = array(
'description' => 'Nodes in block table.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The ID of the node.',
),
'delta' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'size' => 'tiny',
'description' => 'The delta of the block.',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The order of the node in the block.',
),
'visibility' => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Visibility settings.',
),
'render' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => '',
'description' => 'Render type of node in block, teaser, page or a nd string.',
),
),
'primary key' => array(
'nid',
),
'indexes' => array(
'list' => array(
'nid',
'delta',
),
),
);
return $schema;
}
/**
* Update 6001: Add render field to table.
*/
function nodesinblock_update_6001() {
$ret = array();
db_add_field($ret, 'nodes_in_block', 'render', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'size' => 'tiny',
'default' => 0,
));
return $ret;
}
/**
* Update 6002: Rename nodes_in_block table to nodesinblock.
*/
function nodesinblock_update_6002() {
$ret = array();
db_rename_table($ret, 'nodes_in_block', 'nodesinblock');
return $ret;
}
/**
* Update 6002: Rename nodes_in_block table to nodesinblock.
*/
function nodesinblock_update_6003() {
$ret = array();
db_drop_field($ret, 'nodesinblock', 'status');
db_change_field($ret, 'nodesinblock', 'render', 'render', array(
'type' => 'varchar',
'not null' => TRUE,
'length' => 20,
'default' => '',
));
return $ret;
}
Functions
Name | Description |
---|---|
nodesinblock_install | Implementation of hook_install(). |
nodesinblock_schema | Implementation of hook_schema(). |
nodesinblock_uninstall | Implementation of hook_uninstall(). |
nodesinblock_update_6001 | Update 6001: Add render field to table. |
nodesinblock_update_6002 | Update 6002: Rename nodes_in_block table to nodesinblock. |
nodesinblock_update_6003 | Update 6002: Rename nodes_in_block table to nodesinblock. |