aboutsummaryrefslogtreecommitdiff
path: root/lib/classes
diff options
context:
space:
mode:
Diffstat (limited to 'lib/classes')
-rw-r--r--lib/classes/WizardPart.php23
-rw-r--r--lib/classes/forms/Form.php23
2 files changed, 37 insertions, 9 deletions
diff --git a/lib/classes/WizardPart.php b/lib/classes/WizardPart.php
index a932ce9..abf3144 100644
--- a/lib/classes/WizardPart.php
+++ b/lib/classes/WizardPart.php
@@ -19,6 +19,7 @@ use Stringable,
final class WizardPart implements Stringable, JsonSerializable
{
+ private string $id;
private string $type;
private Form|VueApp $content;
private string $title;
@@ -27,19 +28,25 @@ final class WizardPart implements Stringable, JsonSerializable
/**
* Creates a vue app with the given relative path to the app component.
*/
- public static function create(Form|VueApp $content, string $title = '', string $iconShape = ''): WizardPart
+ public static function create(string $id, Form|VueApp $content, string $title = '', string $iconShape = ''): WizardPart
{
- return new static($content, $title, $iconShape);
+ return new static($id, $content, $title, $iconShape);
}
- public function __construct(Form|VueApp $content, string $title = '', string $iconShape = '')
+ public function __construct(string $id, Form|VueApp $content, string $title = '', string $iconShape = '')
{
+ $this->id = $id;
$this->type = get_class($content);
$this->content = $content;
$this->title = $title;
$this->iconShape = $iconShape;
}
+ public function getId(): string
+ {
+ return $this->id;
+ }
+
public function getType(): string
{
return $this->type;
@@ -50,6 +57,16 @@ final class WizardPart implements Stringable, JsonSerializable
return $this->title;
}
+ public function getContent() {
+ return $this->content;
+ }
+
+ public function setId(string $id): WizardPart
+ {
+ $this->id = $id;
+ return $this;
+ }
+
public function setTitle(string $title): WizardPart
{
$this->title = $title;
diff --git a/lib/classes/forms/Form.php b/lib/classes/forms/Form.php
index f4208c4..f34b68d 100644
--- a/lib/classes/forms/Form.php
+++ b/lib/classes/forms/Form.php
@@ -24,7 +24,7 @@ class Form extends Part
protected $cancel_button_name = '';
protected $autoStore = false;
protected $debugmode = false;
- protected $emitValues = false;
+ protected $useStore = false;
protected $withButtons = true;
protected $success_message = '';
@@ -347,22 +347,33 @@ class Form extends Part
}
/**
- * This form doesn't submit to a URL but just emits its values on submitting via eventbus.
+ * Set whether this form uses a Pinia store instead of submitting to a URL.
+ * @param bool $value
+ * @return $this
+ */
+ public function useStore(bool $value = true)
+ {
+ $this->useStore = $value;
+ return $this;
+ }
+
+ /**
+ * This form doesn't call a URL but writes its values to the formStore on submit.
* @return bool|mixed
*/
- public function justEmitsValues()
+ public function usesStore()
{
- return $this->emitValues;
+ return $this->useStore;
}
/**
- * Don't provide buttons for submitting the form -> this form will just emit its values.
+ * Don't provide buttons for submitting the form -> this form will use the pinia store for submitting its values..
* @return Form $this
*/
public function noButtons()
{
$this->withButtons = false;
- $this->emitValues = true;
+ $this->useStore = true;
return $this;
}