You are here

commons_event.install in Drupal Commons 6.2

File

modules/features/commons_event/commons_event.install
View source
<?php

/**
 * Implementation of hook_install()
 */
function commons_event_install() {
  commons_event_add_flag();
  commons_event_add_taxonomy();
}

/**
 * Add the bookmark flag to event nodes
 */
function commons_event_add_flag() {
  $fid = db_result(db_query("SELECT fid FROM {flags} WHERE name = '%s'", 'bookmarks'));
  if ($fid) {
    $check_sql = "SELECT fid FROM {flag_types} WHERE type = 'event' AND fid = %d";
    if (!db_result(db_query($check_sql, $fid))) {
      $flag = new stdClass();
      $flag->fid = $fid;
      $flag->type = 'event';
      drupal_write_record('flag_types', $flag);
    }
  }
}

/**
 * Add taxonomy to event nodes
 */
function commons_event_add_taxonomy() {
  $taxonomy = new stdClass();
  $taxonomy->vid = variable_get('commons_tags_vid', 1);
  $taxonomy->type = 'event';
  drupal_write_record('vocabulary_node_types', $taxonomy);
}

Functions

Namesort descending Description
commons_event_add_flag Add the bookmark flag to event nodes
commons_event_add_taxonomy Add taxonomy to event nodes
commons_event_install Implementation of hook_install()