You are here

public function ColorItemInterface::setColor in Color API 8

Set the human-readable 'name' proprty of the Color Field item.

Parameters

array $color: An array of values to be set for the color. Values will be set based on the keys:

  • hexadecimal: The hexadecimal color string representing the color.
  • rgb: An array containing the following values:
    • red: The value for the RGB "red". An integer between 0 and 255.
    • green: The value for the RGB "green". An integer between 0 and 255.
    • blue: The value for the RGB "blue". An integer between 0 and 255.

bool $notify: Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.

1 method overrides ColorItemInterface::setColor()
ColorItem::setColor in src/Plugin/Field/FieldType/ColorItem.php
Set the human-readable 'name' proprty of the Color Field item.

File

src/Plugin/Field/FieldType/ColorItemInterface.php, line 49

Class

ColorItemInterface
Interface for Field API Color items.

Namespace

Drupal\colorapi\Plugin\Field\FieldType

Code

public function setColor(array $color, $notify = TRUE);