1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00

Add option for InputfieldHidden to still render as an input in renderValue mode

This commit is contained in:
Ryan Cramer
2017-04-19 10:03:30 -04:00
parent c259ce8103
commit e83ed750c9

View File

@@ -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 "<input " . $this->getAttributesString() . " />";
}
public function ___renderValue() {
if($this->renderValueAsInput) {
return $this->render();
} else {
return parent::___renderValue();
}
}
public function getAttributes() {
$attrs = parent::getAttributes();