You are here

public function WebformTemplatesController::previewForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_templates/src/Controller/WebformTemplatesController.php \Drupal\webform_templates\Controller\WebformTemplatesController::previewForm()

Returns a webform to add a new submission to a webform.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current request.

\Drupal\webform\WebformInterface $webform: The webform this submission will be added to.

Return value

array|NotFoundHttpException The webform submission webform.

1 string reference to 'WebformTemplatesController::previewForm'
webform_templates.routing.yml in modules/webform_templates/webform_templates.routing.yml
modules/webform_templates/webform_templates.routing.yml

File

modules/webform_templates/src/Controller/WebformTemplatesController.php, line 191

Class

WebformTemplatesController
Provides route responses for webform templates.

Namespace

Drupal\webform_templates\Controller

Code

public function previewForm(Request $request, WebformInterface $webform) {
  if (!$webform
    ->isTemplate()) {
    return new NotFoundHttpException();
  }
  return $webform
    ->getSubmissionForm([], 'preview');
}