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

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

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,
    );
}