You are here

public function WebformAnalysis::__construct in Webform Analysis 8

Construct.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity of form.

File

src/WebformAnalysis.php, line 26

Class

WebformAnalysis
WebformAnalysis.

Namespace

Drupal\webform_analysis

Code

public function __construct(EntityInterface $entity) {
  if ($entity instanceof WebformInterface) {
    $this->webform = $entity;
    $this->entity = NULL;
  }
  else {
    $this->entity = $entity;
    $this->webform = $entity->webform->entity;
  }
}