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");
}
?>- Login or register to post comments
- 1167 reads
-
- Send feedback



Search
Sitestats
Recent comments
- Create a separate .js file
6 days 21 hours ago - Thanks for your reply
6 days 21 hours ago - Jquery and nice menus
6 days 23 hours ago - Image Menu
1 week 3 days ago - Image menu
1 week 4 days ago - Its cool to have a status!
33 weeks 6 days ago


