Same name and namespace in other branches
  1. 3.0.x src/Feeds/Target/Color.php \Drupal\color_field\Feeds\Target\Color 1 comment
  2. 8.x-2.x src/Feeds/Target/Color.php \Drupal\color_field\Feeds\Target\Color 1 comment

Hierarchy

  • class \Drupal\color_field\Color

Expanded class hierarchy of Color

3 string references to 'Color'
ColorFieldDefaultWidget::formElement in src/Plugin/Field/FieldWidget/ColorFieldDefaultWidget.php
ColorFieldItem::propertyDefinitions in src/Plugin/Field/FieldType/ColorFieldItem.php
ColorFieldItem::schema in src/Plugin/Field/FieldType/ColorFieldItem.php

File

src/Color.php, line 10

Namespace

Drupal\color_field
View 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

Title Sort descending Modifiers Object type Summary
Color::$color protected property The color.
Color::$opacity protected property The opacity.
Color::getColor public function
Color::getOpacity public function
Color::__construct public function Creates a Color instance.
Color::__toString public function Returns the string representation of the color (color, opacity).