mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Add option for InputfieldHidden to still render as an input in renderValue mode
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An Inputfield for handling XHTML "hidden" form inputs
|
* 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 {
|
class InputfieldHidden extends Inputfield {
|
||||||
@@ -18,12 +20,21 @@ class InputfieldHidden extends Inputfield {
|
|||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setAttribute('type', 'hidden');
|
$this->setAttribute('type', 'hidden');
|
||||||
|
$this->set('renderValueAsInput', false);
|
||||||
$this->initValue = '';
|
$this->initValue = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ___render() {
|
public function ___render() {
|
||||||
return "<input " . $this->getAttributesString() . " />";
|
return "<input " . $this->getAttributesString() . " />";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ___renderValue() {
|
||||||
|
if($this->renderValueAsInput) {
|
||||||
|
return $this->render();
|
||||||
|
} else {
|
||||||
|
return parent::___renderValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getAttributes() {
|
public function getAttributes() {
|
||||||
$attrs = parent::getAttributes();
|
$attrs = parent::getAttributes();
|
||||||
|
Reference in New Issue
Block a user