| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Hidden Input Control |
| 5 |
* |
| 6 |
* Main options: |
| 7 |
* name => a name of the control |
| 8 |
* value => a value to show in the control |
| 9 |
* default => a default value of the control if the "value" option is not specified |
| 10 |
* |
| 11 |
* @author Alex Kovalev <alex.kovalevv@gmail.com> |
| 12 |
* @copyright (c) 2018, Webcraftic Ltd |
| 13 |
* |
| 14 |
* @package factory-forms |
| 15 |
* @since 1.0.0 |
| 16 |
*/ |
| 17 |
|
| 18 |
// Exit if accessed directly |
| 19 |
if( !defined('ABSPATH') ) { |
| 20 |
exit; |
| 21 |
} |
| 22 |
|
| 23 |
if( !class_exists('Wbcr_FactoryForms420_HiddenControl') ) { |
| 24 |
|
| 25 |
class Wbcr_FactoryForms420_HiddenControl extends Wbcr_FactoryForms420_Control { |
| 26 |
|
| 27 |
public $type = 'hidden'; |
| 28 |
|
| 29 |
/** |
| 30 |
* Shows the html markup of the control. |
| 31 |
* |
| 32 |
* @since 1.0.0 |
| 33 |
* @return void |
| 34 |
*/ |
| 35 |
public function html() |
| 36 |
{ |
| 37 |
$value = esc_attr($this->getValue()); |
| 38 |
$name_on_form = $this->getNameOnForm(); |
| 39 |
|
| 40 |
$this->addHtmlAttr('id', $name_on_form); |
| 41 |
$this->addHtmlAttr('name', $name_on_form); |
| 42 |
$this->addHtmlAttr('value', $value); |
| 43 |
$this->addHtmlAttr('type', 'hidden'); |
| 44 |
|
| 45 |
?> |
| 46 |
<input <?php $this->attrs() ?>/> |
| 47 |
<?php |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
|