Drupal hook: hook_install
hook_install() creates tables in the database for the module to which its associated. hook_install not just restricted creating tables but it also creates vocabularies, terms in the vocabularies and sets variables to be used by modules. The hook_install set ups the basic requirement for a module to function properly. Not all the modules require to implement hook_install but which saves data to own tables and for providing extra features for which there are no tables or fields exists from where information can be fetched.
- Drupal 5: Table definition and all other required set up for the module
- Drupal 6, 7: drupal_install_schema('[hook]')
Here is an example of hook_install()
<?php
/**
* Implementation of hook_install
*
* @author Drupal Developer
*/
function mynode_install() {
drupal_install_schema("mynode");
}
?>

Recent comments
8 weeks 3 days ago