uc_option_image.install in Ubercart Option Images 7
Same filename and directory in other branches
Provides install and uninstall hooks.
File
uc_option_image.installView source
<?php
/**
* @file
* Provides install and uninstall hooks.
*/
/**
* Implementation of hook_schema().
**/
function uc_option_image_schema() {
$schema = array();
$schema['uc_option_image'] = array(
'description' => 'Stores data for UC Option Image.',
'fields' => array(
'type' => array(
'description' => 'The object type of the data being stored - uc_attribute, uc_option, uc_product or uc_class',
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
),
'aid' => array(
'description' => 'The associated attribute id',
'type' => 'int',
'default' => 0,
),
'oid' => array(
'description' => 'The associated option id',
'type' => 'int',
'default' => 0,
),
'pid' => array(
'description' => 'The associated product id',
'type' => 'int',
'default' => 0,
),
'cid' => array(
'description' => 'The associated class id',
'type' => 'int',
'default' => 0,
),
'fid' => array(
'description' => 'The fid of the associated image',
'type' => 'int',
'default' => 0,
),
'inline_style' => array(
'description' => 'The image style of the image for the inline display mode.',
'type' => 'varchar',
'length' => 255,
'default' => NULL,
),
'inline_active' => array(
'description' => 'Whether inline is active or not',
'type' => 'int',
'default' => 0,
),
'selected_style' => array(
'description' => 'The image style of the image for the selected display mode.',
'type' => 'varchar',
'length' => 255,
'default' => NULL,
),
'selected_active' => array(
'description' => 'Whether selected is active or not',
'type' => 'int',
'default' => 1,
),
),
'indexes' => array(
'aid' => array(
'aid',
),
'aid_oid' => array(
'aid',
'oid',
),
'aid_oid_pid' => array(
'aid',
'oid',
'pid',
),
),
);
return $schema;
}
function uc_option_image_uninstall() {
// remove any images we're associated with
$result = db_select("file_usage", 'fu')
->fields('fu', array(
'fid',
))
->condition('module', 'uc_option_image')
->execute();
foreach ($result as $row) {
$file = file_load($row->fid);
if (!$file) {
continue;
}
file_usage_delete($file, 'uc_option_image');
file_delete($file);
}
}
Functions
Name![]() |
Description |
---|---|
uc_option_image_schema | Implementation of hook_schema(). |
uc_option_image_uninstall |