| 1 |
<?php |
| 2 |
/** |
| 3 |
* Show the product field as dropdown on the front-end. |
| 4 |
* Extra line breaks show as space on the front-end when |
| 5 |
* the form is double filtered and not minimized. |
| 6 |
* |
| 7 |
* @since 6.30 This is copied from the Formidable Pro plugin. |
| 8 |
* |
| 9 |
* @package Formidable |
| 10 |
* |
| 11 |
* @var bool $hide_label |
| 12 |
*/ |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
die( 'You are not allowed to call this page directly.' ); |
| 16 |
} |
| 17 |
?> |
| 18 |
<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $html_id ); ?>" <?php do_action( 'frm_field_input_html', $field ); ?>> |
| 19 |
<?php |
| 20 |
$placeholder = FrmFieldsController::add_placeholder_to_select( $field ); |
| 21 |
$skipped = false; |
| 22 |
|
| 23 |
foreach ( $field['options'] as $opt_key => $opt ) { |
| 24 |
$field_val = FrmFieldsHelper::get_value_from_array( $opt, $opt_key, $field ); |
| 25 |
$selected = FrmAppHelper::check_selected( $field['value'], $field_val ); |
| 26 |
$price = FrmFieldProduct::get_price_from_array( $opt, $opt_key, $field ); |
| 27 |
$opt = FrmFieldsHelper::get_label_from_array( $opt, $opt_key, $field ); |
| 28 |
|
| 29 |
if ( $placeholder && '' === $opt && ! $skipped ) { |
| 30 |
$skipped = true; |
| 31 |
continue; |
| 32 |
} |
| 33 |
FrmHtmlHelper::echo_dropdown_option( |
| 34 |
$opt, |
| 35 |
$selected, |
| 36 |
array( |
| 37 |
'value' => $field_val, |
| 38 |
'data-frmprice' => $price, |
| 39 |
) |
| 40 |
); |
| 41 |
} |
| 42 |
?> |
| 43 |
</select> |
| 44 |
|