You are here

public function AddToCartForm::setEntity in Commerce Core 8.2

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 EntityForm::setEntity

File

modules/cart/src/Form/AddToCartForm.php, line 130

Class

AddToCartForm
Provides the order item add to cart form.

Namespace

Drupal\commerce_cart\Form

Code

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