class Color in Color Field 8
Hierarchy
- class \Drupal\color_field\Color
Expanded class hierarchy of Color
2 string references to 'Color'
- ColorFieldDefaultWidget::formElement in src/
Plugin/ Field/ FieldWidget/ ColorFieldDefaultWidget.php - Returns the form for a single field widget.
- ColorFieldItem::propertyDefinitions in src/
Plugin/ Field/ FieldType/ ColorFieldItem.php - Defines field item properties.
File
- src/
Color.php, line 10 - Contains Drupal\color_field\Color.
Namespace
Drupal\color_fieldView source
class Color {
/**
* The color.
*
* @var string
*/
protected $color;
/**
* The opacity.
*
* @var float
*/
protected $opacity;
/**
* Creates a Color instance.
*
* @param string $color The color.
* @param float $opacity The opacity.
*/
public function __construct($color, $opacity) {
$this->color = $color;
$this->opacity = $opacity;
}
/**
* {@inheritdoc}
*/
public function getColor() {
return $this->color;
}
/**
* {@inheritdoc}
*/
public function getOpacity() {
return $this->opacity;
}
/**
* Returns the string representation of the color (color, opacity).
*
* @return string
*/
public function __toString() {
return $this->color . ' ' . $this->opacity;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Color:: |
protected | property | The color. | |
Color:: |
protected | property | The opacity. | |
Color:: |
public | function | ||
Color:: |
public | function | ||
Color:: |
public | function | Creates a Color instance. | |
Color:: |
public | function | Returns the string representation of the color (color, opacity). |