simplecrop.install in SimpleCrop 7
Contains table description for SimpleCrop module.
File
simplecrop.installView source
<?php
/**
* @file
* Contains table description for SimpleCrop module.
*/
/**
* Implements hook_schema().
*/
function simplecrop_schema() {
$schema['simplecrop'] = array(
'description' => 'This table contains crop data for images.',
'fields' => array(
'uri' => array(
'description' => 'The URI to access an image (either local or remote).',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'binary' => TRUE,
),
'data' => array(
'description' => 'Crop data of an image.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'normal',
),
),
'primary key' => array(
'uri',
),
);
return $schema;
}
/**
* Update settings of field instances that uses simplecrop widget.
* Put some default values of new settings to field widget settings.
*/
function simplecrop_update_7001() {
$field_instances = field_info_instances();
foreach ($field_instances as $field_bundles) {
foreach ($field_bundles as $fields) {
foreach ($fields as $field_instance) {
if (!empty($field_instance['widget']['module']) && $field_instance['widget']['module'] == 'simplecrop') {
$field_instance['widget']['settings']['simplecrop']['cropped']['scale'] = array(
'width' => 100,
'height' => 100,
);
field_update_instance($field_instance);
}
}
}
}
}
Functions
Name![]() |
Description |
---|---|
simplecrop_schema | Implements hook_schema(). |
simplecrop_update_7001 | Update settings of field instances that uses simplecrop widget. Put some default values of new settings to field widget settings. |