| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
class FrmPayPalLiteFieldsController { |
| 7 |
|
| 8 |
/** |
| 9 |
* Hide the email, name, and address fields if they are marked as PayPal order fields. |
| 10 |
* |
| 11 |
* @since 6.31 |
| 12 |
* |
| 13 |
* @param bool $show_normal_field_type Whether to show the field. |
| 14 |
* @param string $type The field type. |
| 15 |
* @param object $field The field object. |
| 16 |
* |
| 17 |
* @return bool |
| 18 |
*/ |
| 19 |
public static function hide_paypal_order_fields( $show_normal_field_type, $type, $field ) { |
| 20 |
if ( ! in_array( $type, array( 'email', 'name', 'address' ), true ) ) { |
| 21 |
return $show_normal_field_type; |
| 22 |
} |
| 23 |
|
| 24 |
$is_paypal_order_field = FrmField::get_option( $field, 'is_paypal_order_field' ); |
| 25 |
|
| 26 |
return $is_paypal_order_field ? false : $show_normal_field_type; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* @param array $field The field settings. |
| 31 |
* @param array $display The display settings for the field. |
| 32 |
* @param array $values The values associated with the field. |
| 33 |
*/ |
| 34 |
public static function add_paypal_order_field_note( $field, $display, $values ) { |
| 35 |
// Add a note about PayPal order fields here. |
| 36 |
if ( ! FrmField::get_option( $field, 'is_paypal_order_field' ) ) { |
| 37 |
return; |
| 38 |
} |
| 39 |
|
| 40 |
echo '<div class="frm_note_style">'; |
| 41 |
esc_html_e( 'This is a PayPal order field. It is automatically populated when a payment is processed, and is automatically excluded from the form HTML.', 'formidable' ); |
| 42 |
echo '</div>'; |
| 43 |
} |
| 44 |
} |
| 45 |
|