function RevisionRevertForm::setEntity

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/Form/RevisionRevertForm.php \Drupal\Core\Entity\Form\RevisionRevertForm::setEntity()

Sets the form entity.

Sets the form entity which will be used for populating form element defaults. Usually, the form entity gets updated by \Drupal\Core\Entity\EntityFormInterface::submit(), however this may be used to completely exchange the form entity, e.g. when preparing the rebuild of a multi-step form.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the current form should operate upon.

Return value

$this

Overrides EntityFormInterface::setEntity

File

core/lib/Drupal/Core/Entity/Form/RevisionRevertForm.php, line 277

Class

RevisionRevertForm
Provides a form for reverting an entity revision.

Namespace

Drupal\Core\Entity\Form

Code

public function setEntity(EntityInterface $entity) {
    assert($entity instanceof RevisionableInterface);
    $this->revision = $entity;
    return $this;
}

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