You are here

public function YamlFormTemplatesController::previewForm in YAML Form 8

Returns a form to add a new submission to a form.

Parameters

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

\Drupal\yamlform\YamlFormInterface $yamlform: The form this submission will be added to.

Return value

array|NotFoundHttpException The form submission form.

1 string reference to 'YamlFormTemplatesController::previewForm'
yamlform_templates.routing.yml in modules/yamlform_templates/yamlform_templates.routing.yml
modules/yamlform_templates/yamlform_templates.routing.yml

File

modules/yamlform_templates/src/Controller/YamlFormTemplatesController.php, line 159

Class

YamlFormTemplatesController
Provides route responses for form templates.

Namespace

Drupal\yamlform_templates\Controller

Code

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