function ModerationStateFieldItemList::get

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

Overrides ItemList::get

File

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

Class

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

Namespace

Drupal\content_moderation\Plugin\Field

Code

public function get($index) {
    if ($index !== 0) {
        throw new \InvalidArgumentException('An entity can not have multiple moderation states at the same time.');
    }
    return $this->traitGet($index);
}

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