You are here

public function EasyEmailController::previewType in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/EasyEmailController.php \Drupal\easy_email\Controller\EasyEmailController::previewType()
1 string reference to 'EasyEmailController::previewType'
easy_email.routing.yml in ./easy_email.routing.yml
easy_email.routing.yml

File

src/Controller/EasyEmailController.php, line 74

Class

EasyEmailController
Class EasyEmailController.

Namespace

Drupal\easy_email\Controller

Code

public function previewType(EasyEmailTypeInterface $easy_email_type) {
  $store = \Drupal::service('tempstore.private')
    ->get('easy_email_type_preview');
  $uuid = $this->requestStack
    ->getCurrentRequest()
    ->get('uuid');
  if (!empty($uuid) && ($preview = $store
    ->get($uuid))) {
    $easy_email = $preview
      ->getFormObject()
      ->getEntity();
    if (!empty($easy_email)) {
      return $this
        ->preview($easy_email);
    }
  }
  throw new AccessDeniedHttpException();
}