You are here

protected function WebformEntityAddForm::prepareEntity in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformEntityAddForm.php \Drupal\webform\WebformEntityAddForm::prepareEntity()

Prepares the entity object before the form is built first.

Overrides EntityForm::prepareEntity

File

src/WebformEntityAddForm.php, line 60

Class

WebformEntityAddForm
Provides a webform add form.

Namespace

Drupal\webform

Code

protected function prepareEntity() {
  if ($this->operation === 'duplicate') {
    $this
      ->setEntity($this
      ->getEntity()
      ->createDuplicate());
  }
  parent::prepareEntity();
}