function ModerationStateFieldItemList::setValue

Same name in other branches
  1. 9 core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList::setValue()
  2. 10 core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList::setValue()
  3. 11.x core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList::setValue()

Overrides ComputedItemListTrait::setValue

File

core/modules/content_moderation/src/Plugin/Field/ModerationStateFieldItemList.php, line 128

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.