1 contact.install contact_install()

Implements hook_install().

File

core/modules/contact/contact.install, line 10
Install, update and uninstall functions for the contact module.

Code

function contact_install() {
  $email = db_query("SELECT mail FROM {users} WHERE uid = 1 AND status = 1")->fetchField();
  if ($email) {
    // Insert a default contact category.
    $contact = array(
      'cid' => 1,
      'category' => 'General',
      'recipients' => $email,
      'reply' => '',
      'weight' => 1,
    );

    $config_data['categories'][] = $contact;
    $config_data['contact_default_category'] = 1;

    $config = config('contact.categories');
    $config->setData($config_data);
    $config->save();
  }
}