View source
<?php
function merci_restrictions_schema() {
$schema = array();
$schema['merci_restrictions'] = array(
'description' => 'Stores merci restrictions.',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Primary Key: Unique ID.',
),
'type' => array(
'description' => 'The {merci_reservation_type}.type of this merci_reservation.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The {taxonomy_term_data}.tid of the term.',
),
) + entity_exportable_schema_fields(),
'primary key' => array(
'id',
),
);
return $schema;
}
function merci_restrictions_uninstall() {
variable_del('merci_restrictions_default');
merci_core_delete_instances('merci_restrictions');
merci_core_delete_fields('merci_restrictions');
}
function merci_restrictions_enable() {
$fields = merci_permissions_merci_fields_info();
merci_core_create_field($fields[MERCI_ALLOWED_ROLES], 'merci_restrictions', 'merci_restrictions');
$fields = merci_restrictions_merci_fields_info();
foreach (array(
MERCI_CHECKOUT_MAX_LENGTH,
MERCI_CHECKOUT_OFFSITE,
) as $field_name) {
merci_core_create_field($fields[$field_name], 'merci_restrictions', 'merci_restrictions');
}
}