You are here

public function ModerationStateFieldItemList::setValue in Config Entity Revisions 8.2

Overrides \Drupal\Core\TypedData\TypedData::setValue().

Parameters

array|null $values: An array of values of the field items, or NULL to unset the field.

Overrides ComputedItemListTrait::setValue

File

src/ModerationStateFieldItemList.php, line 149

Class

ModerationStateFieldItemList
A computed field that provides a content entity's moderation state.

Namespace

Drupal\content_moderation\Plugin\Field

Code

public function setValue($values, $notify = TRUE) {
  parent::setValue($values, $notify);
  $this->valueComputed = TRUE;

  // If the parent created a field item and if the parent should be notified
  // about the change (e.g. this is not initialized with the current value),
  // update the moderated entity.
  if (isset($this->list[0]) && $notify) {
    $this
      ->updateModeratedEntity($this->list[0]->value);
  }
}