You are here

function webform_install in Webform 7.3

Same name and namespace in other branches
  1. 5.2 webform.install \webform_install()
  2. 5 webform.install \webform_install()
  3. 6.3 webform.install \webform_install()
  4. 6.2 webform.install \webform_install()
  5. 7.4 webform.install \webform_install()

Implements hook_install().

File

./webform.install, line 417
Webform module install/schema hooks.

Code

function webform_install() {
  module_load_include('inc', 'node', 'content_types');
  db_update('system')
    ->condition('name', 'webform')
    ->condition('type', 'module')
    ->fields(array(
    'weight' => -1,
  ))
    ->execute();

  // Optionally create the default webform type.
  if (variable_get('webform_install_create_content_type', TRUE)) {
    $webform_type = array(
      'type' => 'webform',
      'name' => st('Webform'),
      'base' => 'node_content',
      'description' => st('Create a new form or questionnaire accessible to users. Submission results and statistics are recorded and accessible to privileged users.'),
      'custom' => TRUE,
      'modified' => TRUE,
      'locked' => FALSE,
    );
    $webform_type = node_type_set_defaults($webform_type);
    node_type_save($webform_type);
    if (variable_get('webform_install_add_body_field', TRUE)) {
      node_add_body_field($webform_type);
    }
  }
}