File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
99
1010## [ Unreleased]
1111
12+ ### Fixed
13+
14+ - Handled errors in form preview
15+
1216## [ 1.1.0]
1317
1418### Added
Original file line number Diff line number Diff line change @@ -139,7 +139,19 @@ public function index(): array {
139139 else {
140140 foreach ($ webforms as $ webform ) {
141141 $ attributes = $ webform ->attributes ;
142- $ form = $ this ->webformHelper ->getSubmissionForm ($ attributes ['elements ' ]);
142+ try {
143+ $ form = $ this ->webformHelper ->getSubmissionForm ($ attributes ['elements ' ]);
144+ }
145+ catch (\Throwable $ t ) {
146+ $ form = [
147+ '#theme ' => 'status_messages ' ,
148+ '#message_list ' => [
149+ 'error ' => [
150+ $ this ->t ('Cannot render form: @message ' , ['@message ' => $ t ->getMessage ()]),
151+ ],
152+ ],
153+ ];
154+ }
143155 // Make sure that the form cannot be submitted (hopefully).
144156 $ form ['#attributes ' ]['onsubmit ' ] = 'return false ' ;
145157
You can’t perform that action at this time.
0 commit comments