Same name and namespace in other branches
- 8.x-2.x src/Plugin/Field/FieldType/ColorFieldType.php \Drupal\color_field\Plugin\Field\FieldType\ColorFieldType::schema()
Fichier
-
src/
Plugin/ Field/ FieldType/ ColorFieldType.php, line 202
Classe
- ColorFieldType
- Plugin implementation of the 'color_type' field type.
Namespace
Drupal\color_field\Plugin\Field\FieldTypeCode
public static function schema(FieldStorageDefinitionInterface $field_definition) : array {
$format = $field_definition->getSetting('format');
$color_length = isset($format) ? strlen($format) : 7;
return [
'columns' => [
'color' => [
'description' => 'The color value',
'type' => 'varchar',
'length' => $color_length,
'not null' => FALSE,
],
'opacity' => [
'description' => 'The opacity/alphavalue property',
'type' => 'float',
'size' => 'tiny',
'not null' => FALSE,
],
],
'indexes' => [
'color' => [
'color',
],
],
];
}