bat_calendar_reference.install in Booking and Availability Management Tools for Drupal 7
Same filename and directory in other branches
Install, update and uninstall functions for the bat_calendar_reference module.
File
modules/bat_calendar_reference/bat_calendar_reference.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the bat_calendar_reference
* module.
*/
/**
* Implements hook_field_schema().
*/
function bat_calendar_reference_field_schema($field) {
if ($field['type'] == 'bat_calendar_unit_reference') {
$columns = array(
'unit_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'event_type_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
);
return array(
'columns' => $columns,
'indexes' => array(
'unit_id' => array(
'unit_id',
),
),
'foreign keys' => array(
'unit_id' => array(
'table' => 'bat_units',
'columns' => array(
'unit_id' => 'unit_id',
),
),
'event_type_id' => array(
'table' => 'bat_calendar_type',
'columns' => array(
'id' => 'id',
),
),
),
);
}
elseif ($field['type'] == 'bat_calendar_unit_type_reference') {
$columns = array(
'unit_type_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'event_type_id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
);
return array(
'columns' => $columns,
'indexes' => array(
'unit_type_id' => array(
'unit_type_id',
),
),
'foreign keys' => array(
'unit_type_id' => array(
'table' => 'bat_types',
'columns' => array(
'type_id' => 'type_id',
),
),
'event_type_id' => array(
'table' => 'bat_calendar_type',
'columns' => array(
'id' => 'id',
),
),
),
);
}
}
Functions
Name | Description |
---|---|
bat_calendar_reference_field_schema | Implements hook_field_schema(). |