action-button.php
2 years ago
calculated-field.php
2 years ago
color-picker-field.php
2 years ago
date-field.php
2 years ago
datetime-field.php
2 years ago
form-break-field.php
2 years ago
group-break-field.php
2 years ago
heading-field.php
2 years ago
hidden-field.php
2 years ago
image-preview.php
2 years ago
media-field.php
2 years ago
number-field.php
2 years ago
preset-media-field.php
2 years ago
progress-bar.php
2 years ago
range-field.php
2 years ago
textarea-field.php
2 years ago
time-field.php
2 years ago
hidden-field.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Field Template |
| 4 | * input[type="hidden"] template |
| 5 | * |
| 6 | * @var \Jet_Form_Builder\Blocks\Render\Base $this |
| 7 | */ |
| 8 | |
| 9 | use Jet_Form_Builder\Blocks\Dynamic_Value; |
| 10 | use Jet_Form_Builder\Classes\Regexp_Tools; |
| 11 | |
| 12 | // If this file is called directly, abort. |
| 13 | if ( ! defined( 'WPINC' ) ) { |
| 14 | die; |
| 15 | } |
| 16 | |
| 17 | $this->add_attribute( 'class', 'jet-form-builder__field hidden-field' ); |
| 18 | $this->add_attribute( 'class', $args['class_name'] ); |
| 19 | $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] ) ); |
| 20 | $this->add_attribute( 'data-field-name', $args['name'] ); |
| 21 | |
| 22 | /** |
| 23 | * We need to watch only real hidden fields. |
| 24 | * Not static. |
| 25 | * |
| 26 | * @see \Jet_Form_Builder\Blocks\Render\Form_Hidden_Fields::render |
| 27 | */ |
| 28 | if ( empty( $this->args['_static_value'] ) ) { |
| 29 | $this->add_attribute( 'data-jfb-sync' ); |
| 30 | } |
| 31 | |
| 32 | if ( ! jet_form_builder()->regexp->has_macro( $this->args['field_value'] ) ) { |
| 33 | $this->add_attribute( 'value', $this->args['field_value'] ); |
| 34 | } else { |
| 35 | wp_enqueue_script( Dynamic_Value::HANDLE ); |
| 36 | |
| 37 | $this->add_attribute( 'data-value', $this->args['field_value'] ); |
| 38 | } |
| 39 | |
| 40 | // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped |
| 41 | ?> |
| 42 | <input type="hidden" <?php $this->render_attributes_string(); ?>> |
| 43 | <?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped |
| 44 |