You are here

function color_field_field_schema in Color Field 7.2

Same name and namespace in other branches
  1. 7 color_field.install \color_field_field_schema()

Implements hook_field_schema().

Defines the database schema of the field, using the format used by the Schema API.

The data we will store here is just one 7-character element and an alpha int.

File

./color_field.install, line 16
Install, update, and uninstall functions.

Code

function color_field_field_schema($field) {
  $columns = array(
    'rgb' => array(
      'description' => 'The RGB hex values prefix with #',
      'type' => 'varchar',
      'length' => 7,
      'not null' => FALSE,
    ),
    'opacity' => array(
      'description' => 'The opacity/alphavalue property',
      'type' => 'float',
      'size' => 'tiny',
      'not null' => FALSE,
      'default' => 1,
    ),
  );
  $indexes = array(
    'rgb' => array(
      'rgb',
    ),
  );
  return array(
    'columns' => $columns,
    'indexes' => $indexes,
  );
}