From e83ed750c98d934030e3d40d9d6bbc1c70463e27 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Wed, 19 Apr 2017 10:03:30 -0400 Subject: [PATCH] Add option for InputfieldHidden to still render as an input in renderValue mode --- wire/modules/Inputfield/InputfieldHidden.module | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wire/modules/Inputfield/InputfieldHidden.module b/wire/modules/Inputfield/InputfieldHidden.module index 0bc7b2f0..4dc1617f 100644 --- a/wire/modules/Inputfield/InputfieldHidden.module +++ b/wire/modules/Inputfield/InputfieldHidden.module @@ -2,6 +2,8 @@ /** * An Inputfield for handling XHTML "hidden" form inputs + * + * @property bool $renderValueAsInput Render the hidden input, even when in renderValue mode (default=false) * */ class InputfieldHidden extends Inputfield { @@ -18,12 +20,21 @@ class InputfieldHidden extends Inputfield { public function __construct() { parent::__construct(); $this->setAttribute('type', 'hidden'); + $this->set('renderValueAsInput', false); $this->initValue = ''; } public function ___render() { return "getAttributesString() . " />"; } + + public function ___renderValue() { + if($this->renderValueAsInput) { + return $this->render(); + } else { + return parent::___renderValue(); + } + } public function getAttributes() { $attrs = parent::getAttributes();