You are here

protected function CouponForm::prepareEntity in Commerce Core 8.2

Prepares the entity object before the form is built first.

Overrides ContentEntityForm::prepareEntity

File

modules/promotion/src/Form/CouponForm.php, line 13

Class

CouponForm

Namespace

Drupal\commerce_promotion\Form

Code

protected function prepareEntity() {
  if ($this->entity
    ->isNew()) {
    $promotion = $this
      ->getRouteMatch()
      ->getParameter('commerce_promotion');
    $this->entity
      ->set('promotion_id', $promotion);
  }
}