PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.4
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.4
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 134 releases
jetformbuilder / templates / fields / hidden-field.php

hidden-field.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.5.4, at templates/fields/hidden-field.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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