You are here

function _color_field_update_7000_add_opacity_column in Color Field 7.2

Add opacity column to a specific table.

Parameters

string $table: The name of the database table to be updated.

string $field_name: Keyed array of columns this table is supposed to have.

1 call to _color_field_update_7000_add_opacity_column()
color_field_update_7000 in ./color_field.install
Add opacity column to color field schema and populate with a default value of 1.

File

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

Code

function _color_field_update_7000_add_opacity_column($table, $field_name) {
  $spec = array(
    'description' => 'The opacity/alphavalue property',
    'type' => 'float',
    'size' => 'tiny',
    'not null' => FALSE,
    'default' => 1,
  );
  $spec['description'] = 'The width of the image in pixels.';

  // Make sure the field does not exist yet.
  if (!db_field_exists($table, $field_name . '_opacity')) {
    db_add_field($table, $field_name . '_opacity', $spec);
  }
}