PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.0.4
JetFormBuilder — Dynamic Blocks Form Builder v2.0.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 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / templates / fields / media-field.php
jetformbuilder / templates / fields Last commit date
action-button.php 4 years ago calculated-field.php 4 years ago checkbox-field.php 4 years ago color-picker-field.php 4 years ago date-field.php 4 years ago datetime-field.php 4 years ago form-break-field.php 4 years ago group-break-field.php 4 years ago heading-field.php 4 years ago hidden-field.php 4 years ago media-field.php 4 years ago number-field.php 4 years ago progress-bar.php 4 years ago radio-field.php 4 years ago range-field.php 4 years ago select-field.php 4 years ago text-field.php 4 years ago textarea-field.php 4 years ago time-field.php 4 years ago wysiwyg-field.php 4 years ago
media-field.php
71 lines
1 <?php
2 /**
3 * Media field template
4 */
5
6 use Jet_Form_Builder\File_Upload;
7 use Jet_Form_Builder\Classes\Tools;
8
9 $this->add_attribute( 'class', 'jet-form-builder__field file-field jet-form-builder-file-upload__input' );
10 $this->add_attribute( 'class', $this->maybe_get_error_class( $args ) );
11 $this->add_attribute( 'class', $args['class_name'] );
12 $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] . '_input' ) );
13 $this->add_attribute( 'type', 'file' );
14 $this->add_attribute( 'data-form_id', $this->form_id );
15 $this->add_attribute( 'data-field', $args['name'] );
16 $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) );
17
18 if ( ! empty( $args['max_files'] ) ) {
19 $this->add_attribute( 'data-max_files', absint( $args['max_files'] ) );
20 $this->add_attribute( 'multiple', true );
21 }
22
23 if ( ! empty( $args['allowed_mimes'] ) ) {
24 $this->add_attribute( 'accept', implode( ',', $args['allowed_mimes'] ) );
25 }
26
27 $max_size = File_Upload::instance()->get_max_size_for_field( $args );
28
29 $this->add_attribute( 'data-max_size', $max_size );
30
31 $required = $this->block_type->get_required_val( $args );
32
33 if ( ! empty( $args['insert_attachment'] ) ) {
34 $format = ! empty( $args['value_format'] ) ? $args['value_format'] : 'url';
35 } else {
36 $format = 'url';
37 }
38
39 $value = File_Upload::instance()->get_result_value( $args );
40 $value = is_array( $value ) || ( 'url' === $format ) ? wp_json_encode( $value ) : $value;
41 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
42 ?>
43 <div class="jet-form-builder__field-wrap jet-form-builder-file-upload">
44 <div class="jet-form-builder-file-upload__content">
45 <?php echo File_Upload::instance()->get_loader(); ?>
46 <div class="jet-form-builder-file-upload__files" <?php echo File_Upload::instance()->get_files_data_args( $this->block_type->block_attrs ); ?>>
47 <?php
48 echo File_Upload::instance()->get_result_html( $args );
49 ?>
50 </div>
51 </div>
52 <div class="jet-form-builder-file-upload__fields">
53 <input class="jet-form-builder-file-upload__value"
54 type="hidden"
55 name="<?php echo esc_attr( $this->block_type->get_field_name( $args['name'] ) ); ?>"
56 data-field-name="<?php echo esc_attr( $args['name'] ); ?>"
57 value="<?php echo htmlspecialchars( $value ); ?>"
58 <?php
59 if ( $required ) {
60 echo ' required="required"';
61 }
62 ?>
63 >
64 <input <?php $this->render_attributes_string(); ?>>
65 <?php echo Tools::esc_template_string( $this->maybe_render_error( $args ) ); ?>
66 </div>
67 <div class="jet-form-builder-file-upload__message"><small><?php echo __( 'Maximum file size', 'jet-form-builder' ); ?>: <?php echo size_format( $max_size ); ?></small></div>
68 <div class="jet-form-builder-file-upload__errors is-hidden"></div>
69 </div>
70 <?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped ?>
71