class ModerationStateFieldItemList extends FieldItemList
{ use ComputedItemListTrait
{ get
as traitGet;
} /**
* {@inheritdoc}
*/
protected function computeValue() { $moderation_state =
$this->
getModerationStateId();
// Do not store NULL values, in the case where an entity does not have a
// moderation workflow associated with it, we do not create list items for
// the computed field.
if ($moderation_state) { // An entity can only have a single moderation state.
$this->list
[0
] =
$this->
createItem(0,
$moderation_state);
} } /**
* Gets the moderation state ID linked to a content entity revision.
*
* @return string|null
* The moderation state ID linked to a content entity revision.
*/