function ContentModerationState::save
Overrides EntityBase::save
File
- 
              core/
modules/ content_moderation/ src/ Entity/ ContentModerationState.php, line 167  
Class
- ContentModerationState
 - Defines the Content moderation state entity.
 
Namespace
Drupal\content_moderation\EntityCode
public function save() {
  /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
  $storage = \Drupal::entityTypeManager()->getStorage($this->content_entity_type_id->value);
  $related_entity = $storage->loadRevision($this->content_entity_revision_id->value);
  if ($related_entity instanceof TranslatableInterface) {
    $related_entity = $related_entity->getTranslation($this->activeLangcode);
  }
  $related_entity->moderation_state = $this->moderation_state;
  return $related_entity->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.