PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Entity/Form/Form.php +66 -3 1.1.1 → 1.5 View file →
@@ -6,12 +6,13 @@
6 6 */
7 7
8 8 namespace IvyForms\Entity\Form;
9 9
10 -use IvyForms\Services\Template\TemplateDefaults;
11 10 use IvyForms\ValueObjects\Form\Form as FormValueObject;
12 11 use IvyForms\ValueObjects\Form\IntegrationSettings;
12 +use IvyForms\ValueObjects\Form\PaymentSettings;
13 13 use IvyForms\ValueObjects\Form\StyleSettings;
14 +use IvyForms\Services\Template\TemplateDefaults;
14 15
15 16 /**
16 17 * Class Form
17 18 *
@@ -24,8 +25,15 @@
24 25 */
25 26 private FormValueObject $form;
26 27
27 28 /**
29 + * Top-level extension keys (e.g. Pro settings) for the request lifecycle.
30 + *
31 + * @var array<string, mixed>
32 + */
33 + private array $extensionData = [];
34 +
35 + /**
28 36 * Form constructor.
29 37 *
30 38 * @param FormValueObject $form The form object.
31 39 */
@@ -34,8 +42,24 @@
34 42 $this->form = $form;
35 43 }
36 44
37 45 /**
46 + * @param array<string, mixed> $data
47 + */
48 + public function setExtensionData(array $data): void
49 + {
50 + $this->extensionData = $data;
51 + }
52 +
53 + /**
54 + * @return array<string, mixed>
55 + */
56 + public function getExtensionData(): array
57 + {
58 + return $this->extensionData;
59 + }
60 +
61 + /**
38 62 * Get the ID of the form.
39 63 *
40 64 * @return int The form ID.
41 65 */
@@ -74,8 +98,24 @@
74 98 $this->form->name = $name;
75 99 }
76 100
77 101 /**
102 + * @return string classic|conversational
103 + */
104 + public function getFormType(): string
105 + {
106 + return $this->form->getFormType();
107 + }
108 +
109 + /**
110 + * @param string $formType
111 + */
112 + public function setFormType(string $formType): void
113 + {
114 + $this->form->setFormType($formType);
115 + }
116 +
117 + /**
78 118 * Get the author of the form.
79 119 *
80 120 * @return string The form author.
81 121 */
@@ -326,8 +366,24 @@
326 366 $this->form->formActionButtons = $formActionButtons;
327 367 }
328 368
329 369 /**
370 + * Get payment-related form settings (e.g., currency).
371 + */
372 + public function getPaymentSettings(): PaymentSettings
373 + {
374 + return $this->form->getPaymentSettings();
375 + }
376 +
377 + /**
378 + * Set payment-related form settings.
379 + */
380 + public function setPaymentSettings(PaymentSettings $paymentSettings): void
381 + {
382 + $this->form->setPaymentSettings($paymentSettings);
383 + }
384 +
385 + /**
330 386 * Get style settings as array
331 387 *
332 388 * @return array<string, mixed>
333 389 */
@@ -365,9 +421,9 @@
365 421 $integrationPayload = $integrationSettings !== null
366 422 ? $integrationSettings->toArray()
367 423 : ['integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings()];
368 424
369 - return array_merge(
425 + $data = array_merge(
370 426 [
371 427 'id' => $this->getId(),
372 428 'name' => $this->getName(),
373 429 'author' => $this->getAuthor(),
@@ -376,8 +432,9 @@
376 432 'dateCreated' => $this->getDateCreated(),
377 433 'dateEdited' => $this->getDateEdited(),
378 434 'fields' => $this->getFields(),
379 435 'description' => $this->getDescription(),
436 + 'formType' => $this->getFormType(),
380 437 'showTitle' => $this->isTitleVisible(),
381 438 'showDescription' => $this->isDescriptionVisible(),
382 439 'storeEntries' => $this->isStoreEntries(),
383 440 'pages' => $this->getPages(),
@@ -384,8 +441,14 @@
384 441 'progressIndicator' => $this->getProgressIndicator(),
385 442 'styleSettings' => $this->getStyleSettings(),
386 443 'formActionButtons' => $this->getFormActionButtons(),
387 444 ],
388 - $integrationPayload
445 + $this->form->metadata->toArray(),
446 + $this->form->settings->toArray(),
447 + $integrationPayload,
448 + $this->extensionData,
449 + $this->getPaymentSettings()->toArray()
389 450 );
451 +
452 + return $data;
390 453 }
391 454 }