You are here

public function EasyEmailController::previewPage in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/EasyEmailController.php \Drupal\easy_email\Controller\EasyEmailController::previewPage()

File

src/Controller/EasyEmailController.php, line 100

Class

EasyEmailController
Class EasyEmailController.

Namespace

Drupal\easy_email\Controller

Code

public function previewPage(EasyEmailTypeInterface $easy_email_type) {
  $email = \Drupal::entityTypeManager()
    ->getStorage('easy_email')
    ->create([
    'type' => $easy_email_type
      ->id(),
  ]);

  /** @var \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder */
  $entity_form_builder = \Drupal::service('entity.form_builder');
  $form = $entity_form_builder
    ->getForm($email, 'default', [
    'easy_email_type_preview' => TRUE,
  ]);
  return $form;
}