• Avail guidance to develop Drupal modules & Drupal themes
  • Share and get review of your code
  • Get Access to free CodeBooks and ThemeBooks
  • Drupal 5, 6 and 7 covered

About bhavinhjoshi

Drupal hook: hook_install

Printer-friendly versionSend to a DeveloperPDF version
2
0

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");
}
?>

Syndicate content

Sitestats

Recent comments

rss-top-right.png
toolbar powered by www.iconcy.com