wordfilter.install in Wordfilter 7
Same filename and directory in other branches
Module install and update functions for the Wordfilter module.
File
wordfilter.installView source
<?php
/**
* @file
* Module install and update functions for the Wordfilter module.
*/
/**
* Implements hook_schema().
*/
function wordfilter_schema() {
$schema['wordfilter'] = array(
'description' => 'The {wordfilter} table stores user ids of users and other users that they have chosen to ignore.',
'fields' => array(
'id' => array(
'description' => 'The ID of the wordfilter word pair.',
'type' => 'serial',
'not null' => TRUE,
),
'words' => array(
'description' => 'The word to filter.',
'type' => 'text',
'not null' => TRUE,
),
'replacement' => array(
'description' => 'The replacement word to filter with.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'language' => array(
'description' => 'The {languages}.language of this word to filter.',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
),
'standalone' => array(
'description' => 'A boolean to indicate if the word filtering should only be done if the word is not part of another word.',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'id',
),
);
return $schema;
}
/**
* Implements hook_enable().
*/
function wordfilter_enable() {
drupal_set_message(t('To filter text with Word filter you will need to enable the Word filter in one or more of your <a href="@text_formats">Text formats</a>. To add words or phrases to filter, <a href="@configure">configure Word Filter module</a>.', array(
'@text_formats' => url('admin/config/content/formats'),
'@configure' => url('admin/config/content/wordfilter'),
)), 'status');
}
/**
* Implements hook_uninstall().
*/
function wordfilter_uninstall() {
variable_del('wordfilter_comment_title');
variable_del('wordfilter_default_replacement');
variable_del('wordfilter_node_title');
variable_del('wordfilter_process_case_sensitive');
variable_del('wordfilter_use_utf8_flag');
}
/**
* Implements hook_update_last_removed().
*
* So we don't need to update all the update function to dbtng.
*/
function wordfilter_update_last_removed() {
return 6100;
}
Functions
Name![]() |
Description |
---|---|
wordfilter_enable | Implements hook_enable(). |
wordfilter_schema | Implements hook_schema(). |
wordfilter_uninstall | Implements hook_uninstall(). |
wordfilter_update_last_removed | Implements hook_update_last_removed(). |