function EntityOperations::entityFormEntityBuild

Same name in other branches
  1. 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityFormEntityBuild()
  2. 8.9.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityFormEntityBuild()
  3. 10 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityFormEntityBuild()

Entity builder that marks all supported entities as pending revisions.

File

core/modules/workspaces/src/EntityOperations.php, line 334

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\workspaces

Code

public static function entityFormEntityBuild($entity_type_id, RevisionableInterface $entity, &$form, FormStateInterface &$form_state) {
    // Ensure that all entity forms are signaling that a new revision will be
    // created.
    $entity->setNewRevision(TRUE);
    // Set the non-default revision flag so that validation constraints are also
    // aware that a pending revision is about to be created.
    $entity->isDefaultRevision(FALSE);
}

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