You are here

public function ColorItem::setRed in Color API 8

Set 'red' property of the Color Field 'Color' property's 'RGB' property.

Parameters

string $red: The value for the RGB "red" property. 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.

Overrides ColorItemInterface::setRed

1 call to ColorItem::setRed()
ColorItem::setValue in src/Plugin/Field/FieldType/ColorItem.php
Sets the data value.

File

src/Plugin/Field/FieldType/ColorItem.php, line 154

Class

ColorItem
Provides the Color field.

Namespace

Drupal\colorapi\Plugin\Field\FieldType

Code

public function setRed($red, $notify = TRUE) {
  $this
    ->get('color')
    ->setRed($red, $notify);
}