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
- 1195 reads
-
- Send feedback



Recherche
Sitestats
Recent comments
- Create a separate .js file
1 semaine 6 jours ago - Thanks for your reply
1 semaine 6 jours ago - Jquery and nice menus
1 semaine 6 jours ago - Image Menu
2 semaines 3 jours ago - Image menu
2 semaines 4 jours ago - Its cool to have a status!
34 semaines 6 jours ago


