ajaxblocks.install in Ajax Blocks 6
Same filename and directory in other branches
Install, update and uninstall functions for the ajaxblocks module.
File
ajaxblocks.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the ajaxblocks module.
*/
/**
* Implements hook_schema().
*/
function ajaxblocks_schema() {
$schema = array();
$schema['ajaxblocks'] = array(
'description' => 'Stores AJAX settings for blocks.',
'fields' => array(
'block_id' => array(
'description' => 'The primary identifier for a block.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'is_ajax' => array(
'description' => 'Boolean indicating whether the block is to be loaded via AJAX.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'loader_picture' => array(
'description' => 'Loader picture index (0 - none).',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'is_late' => array(
'description' => 'Boolean indicating whether to use window.onload event.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'delay' => array(
'description' => 'Time to wait before block loading.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'include_noscript' => array(
'description' => 'Boolean indicating whether to include noscript tag.',
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'cached_roles' => array(
'description' => 'Roles for which the block is loaded via AJAX for cached pages.',
'type' => 'varchar',
'length' => 1000,
'default' => '1',
),
'uncached_roles' => array(
'description' => 'Roles for which the block is loaded via AJAX for uncached pages.',
'type' => 'varchar',
'length' => 1000,
'default' => '',
),
),
'primary key' => array(
'block_id',
),
);
return $schema;
}
/**
* Implements hook_install().
*/
function ajaxblocks_install() {
drupal_install_schema('ajaxblocks');
}
/**
* Implements hook_uninstall().
*/
function ajaxblocks_uninstall() {
drupal_uninstall_schema('ajaxblocks');
cache_clear_all('ajaxblocks', 'cache');
}
/**
* Add loader_picture field.
*/
function ajaxblocks_update_6100() {
$ret = array();
db_add_field($ret, 'ajaxblock', 'loader_picture', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
return $ret;
}
/**
* Rename table ajaxblock -> ajaxblocks.
*/
function ajaxblocks_update_6101() {
$ret = array();
db_rename_table($ret, 'ajaxblock', 'ajaxblocks');
return $ret;
}
/**
* Add fields.
*/
function ajaxblocks_update_6102() {
$ret = array();
db_add_field($ret, 'ajaxblocks', 'is_late', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
db_add_field($ret, 'ajaxblocks', 'delay', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
));
db_add_field($ret, 'ajaxblocks', 'include_noscript', array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
));
db_add_field($ret, 'ajaxblocks', 'cached_roles', array(
'type' => 'varchar',
'length' => 1000,
'default' => '1',
));
db_add_field($ret, 'ajaxblocks', 'uncached_roles', array(
'type' => 'varchar',
'length' => 1000,
'default' => '',
));
return $ret;
}
Functions
Name | Description |
---|---|
ajaxblocks_install | Implements hook_install(). |
ajaxblocks_schema | Implements hook_schema(). |
ajaxblocks_uninstall | Implements hook_uninstall(). |
ajaxblocks_update_6100 | Add loader_picture field. |
ajaxblocks_update_6101 | Rename table ajaxblock -> ajaxblocks. |
ajaxblocks_update_6102 | Add fields. |