From bf4cd1bf37c8c3127558e856c99bf83f73726b9e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 26 Aug 2019 19:39:13 +0200 Subject: [PATCH] Add hidden form field Close #3053 --- .../templates/__hiddenFormField.tpl | 5 ++++ .../files/acp/templates/__hiddenFormField.tpl | 5 ++++ .../builder/field/HiddenFormField.class.php | 29 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 com.woltlab.wcf/templates/__hiddenFormField.tpl create mode 100644 wcfsetup/install/files/acp/templates/__hiddenFormField.tpl create mode 100644 wcfsetup/install/files/lib/system/form/builder/field/HiddenFormField.class.php diff --git a/com.woltlab.wcf/templates/__hiddenFormField.tpl b/com.woltlab.wcf/templates/__hiddenFormField.tpl new file mode 100644 index 0000000000..7f92db9891 --- /dev/null +++ b/com.woltlab.wcf/templates/__hiddenFormField.tpl @@ -0,0 +1,5 @@ + diff --git a/wcfsetup/install/files/acp/templates/__hiddenFormField.tpl b/wcfsetup/install/files/acp/templates/__hiddenFormField.tpl new file mode 100644 index 0000000000..7f92db9891 --- /dev/null +++ b/wcfsetup/install/files/acp/templates/__hiddenFormField.tpl @@ -0,0 +1,5 @@ + diff --git a/wcfsetup/install/files/lib/system/form/builder/field/HiddenFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/HiddenFormField.class.php new file mode 100644 index 0000000000..ca6438d5de --- /dev/null +++ b/wcfsetup/install/files/lib/system/form/builder/field/HiddenFormField.class.php @@ -0,0 +1,29 @@ + + * @package WoltLabSuite\Core\System\Form\Builder\Field + * @since 5.2 + */ +class HiddenFormField extends AbstractFormField { + /** + * @inheritDoc + */ + protected $templateName = '__hiddenFormField'; + + /** + * @inheritDoc + */ + public function readValue() { + if ($this->getDocument()->hasRequestData($this->getPrefixedId())) { + $this->value = $this->getDocument()->getRequestData($this->getPrefixedId()); + } + + return $this; + } +} -- 2.20.1