PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / trunk
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder vtrunk
6.2.15 6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 All 197 releases
← All changes | app/Models/Traits/PredefinedForms.php +15 -0 6.2.4 → trunk View file →
@@ -8,8 +8,23 @@
8 8 trait PredefinedForms
9 9 {
10 10 public static function resolvePredefinedForm($attributes = [])
11 11 {
12 + // A create request must name a template. Without this, Arr::get($map, null)
13 + // inside findPredefinedForm() returns the WHOLE template map — a non-empty
14 + // array that sails past both guards below and yields a form persisted with
15 + // NULL form_fields. findPredefinedForm() itself keeps that whole-map
16 + // behaviour on purpose: FormService::templates() depends on it.
17 + $hasTemplateId = Arr::get($attributes, 'predefined')
18 + || 'blank_conversational' === Arr::get($attributes, 'type');
19 +
20 + if (!$hasTemplateId) {
21 + throw new Exception(
22 + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- Exception message, not output
23 + __("The selected template couldn't be found.", 'fluentform')
24 + );
25 + }
26 +
12 27 $predefinedForm = static::findPredefinedForm($attributes);
13 28
14 29 if (!$predefinedForm) {
15 30 throw new Exception(