Problem/Motivation

This was left over from the Node handler, it should be clarified if it's used or not.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Sam152 created an issue. See original summary.

timmillwood’s picture

Issue tags: +Workflow Initiative
timmillwood’s picture

In #2812811: Use EntityPublishedInterface during moderation of entities to add support beyond nodes I am proposing to remove this code from the handler, it doesn't seem as though it's needed.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

amateescu’s picture

Status: Active » Closed (outdated)

I just looked at \Drupal\content_moderation\EntityOperations::entityPresave() and there's no isDefaultTranslation() anymore:

  public function entityPresave(EntityInterface $entity) {
    if (!$this->moderationInfo->isModeratedEntity($entity)) {
      return;
    }

    if ($entity->moderation_state->value) {
      $workflow = $this->moderationInfo->getWorkflowForEntity($entity);
      /** @var \Drupal\content_moderation\ContentModerationState $current_state */
      $current_state = $workflow->getState($entity->moderation_state->value);

      // This entity is default if it is new, a new translation, the default
      // revision, or the default revision is not published.
      $update_default_revision = $entity->isNew()
        || $entity->isNewTranslation()
        || $current_state->isDefaultRevisionState()
        || !$this->moderationInfo->isDefaultRevisionPublished($entity);

      // Fire per-entity-type logic for handling the save process.
      $this->entityTypeManager->getHandler($entity->getEntityTypeId(), 'moderation')->onPresave($entity, $update_default_revision, $current_state->isPublishedState());
    }
  }