PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / views / frm-fields / front-end / product-radio.php

product-radio.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More trunk, at classes/views/frm-fields/front-end/product-radio.php

63 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 die( 'You are not allowed to call this page directly.' );
5 }
6
7 /**
8 * Show the product field as radio button or checkbox on the front-end.
9 * Extra line breaks show as space on the front-end when
10 * the form is double filtered and not minimized.
11 *
12 * @since 6.30 This is copied from the Formidable Pro plugin.
13 *
14 * @var bool $hide_label
15 */
16
17 $display_type = $field['data_type'];
18
19 if ( $display_type !== 'radio' && $display_type !== 'checkbox' ) {
20 return;
21 }
22
23 if ( $display_type === 'checkbox' ) {
24 $field_name .= '[]';
25 }
26
27 $option_index = 0;
28
29 foreach ( $field['options'] as $opt_key => $opt ) {
30 if ( isset( $shortcode_atts ) && isset( $shortcode_atts['opt'] ) && $shortcode_atts['opt'] !== $opt_key ) {
31 continue;
32 }
33
34 $field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field );
35 $price = FrmFieldProduct::get_price_from_array( $opt, $opt_key, $field );
36 $opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field );
37 ?>
38 <div class="<?php echo esc_attr( apply_filters( 'frm_' . $display_type . '_class', 'frm_' . $display_type, $field, $field_val ) ); ?>" id="<?php echo esc_attr( FrmFieldsHelper::get_checkbox_id( $field, $opt_key, $display_type ) ); ?>"><?php
39
40 if ( empty( $hide_label ) ) {
41 ?><label for="<?php echo esc_attr( $html_id ); ?>-<?php echo esc_attr( $opt_key ); ?>"><?php
42 }
43 ?>
44 <input type="<?php echo esc_attr( $display_type ); ?>" name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ); ?>" value="<?php echo esc_attr( $field_val ); ?>"<?php
45
46 FrmAppHelper::checked( $field['value'], $field_val );
47
48 if ( 0 === $option_index && FrmField::is_required( $field ) ) {
49 echo ' aria-required="true" ';
50 }
51
52 ?> data-frmprice="<?php echo esc_attr( $price ); ?>" <?php do_action( 'frm_field_input_html', $field ); ?> /><?php
53
54 if ( empty( $hide_label ) ) {
55 echo ' ';
56 FrmAppHelper::kses_echo( $opt, 'all' );
57 echo '</label>';
58 }
59 ?></div>
60 <?php
61 ++$option_index;
62 }//end foreach
63