| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - die( 'You are not allowed to call this page directly.' ); | |
| 4 | -} | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * @since 3.0 |
| 8 | 5 | */ |
| @@ -9,86 +6,29 @@ | ||
| 9 | 6 | class FrmFieldPhone extends FrmFieldType { |
| 10 | 7 | |
| 11 | 8 | /** |
| 12 | 9 | * @var string |
| 13 | - * | |
| 14 | 10 | * @since 3.0 |
| 15 | 11 | */ |
| 16 | 12 | protected $type = 'phone'; |
| 13 | + protected $display_type = 'text'; | |
| 17 | 14 | |
| 18 | 15 | /** |
| 19 | 16 | * @var bool |
| 20 | - * | |
| 21 | 17 | * @since 3.0 |
| 22 | 18 | */ |
| 23 | 19 | protected $holds_email_values = true; |
| 24 | 20 | |
| 25 | - /** | |
| 26 | - * @var bool | |
| 27 | - */ | |
| 28 | - protected $array_allowed = false; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * @return bool[] | |
| 32 | - */ | |
| 33 | 21 | protected function field_settings_for_type() { |
| 34 | 22 | return array( |
| 35 | 23 | 'size' => true, |
| 36 | 24 | 'clear_on_focus' => true, |
| 37 | 25 | 'invalid' => true, |
| 26 | + 'format' => true, | |
| 38 | 27 | ); |
| 39 | 28 | } |
| 40 | 29 | |
| 41 | - /** | |
| 42 | - * @since 6.9 | |
| 43 | - * | |
| 44 | - * @param array $args Includes 'field', 'display', and 'values'. | |
| 45 | - * | |
| 46 | - * @return void | |
| 47 | - */ | |
| 48 | - public function show_primary_options( $args ) { | |
| 49 | - $field = $args['field']; | |
| 50 | - | |
| 51 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/phone/phone-type.php'; | |
| 52 | - FrmFieldsController::show_format_option( $field, true ); | |
| 53 | - | |
| 54 | - parent::show_primary_options( $args ); | |
| 55 | - } | |
| 56 | - | |
| 57 | - /** | |
| 58 | - * Retrieves the HTML for an 'International' option in a dropdown. | |
| 59 | - * | |
| 60 | - * @since 6.9 | |
| 61 | - * | |
| 62 | - * @return void Outputs the HTML option tag directly. | |
| 63 | - */ | |
| 64 | - protected function print_international_option() { | |
| 65 | - ?> | |
| 66 | - <option | |
| 67 | - value="" | |
| 68 | - class="frm_show_upgrade frm_noallow" | |
| 69 | - data-upgrade="<?php esc_attr_e( 'International phone field', 'formidable' ); ?>" | |
| 70 | - data-medium="international-phone-field" | |
| 71 | - > | |
| 72 | - <?php esc_html_e( 'International', 'formidable' ); ?> | |
| 73 | - </option> | |
| 74 | - <?php | |
| 75 | - } | |
| 76 | - | |
| 77 | - /** | |
| 78 | - * @return string | |
| 79 | - */ | |
| 80 | 30 | protected function html5_input_type() { |
| 81 | - return 'tel'; | |
| 82 | - } | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * @since 4.0.04 | |
| 86 | - * | |
| 87 | - * @param array|string $value | |
| 88 | - * | |
| 89 | - * @return void | |
| 90 | - */ | |
| 91 | - public function sanitize_value( &$value ) { | |
| 92 | - FrmAppHelper::sanitize_value( 'sanitize_text_field', $value ); | |
| 31 | + $frm_settings = FrmAppHelper::get_settings(); | |
| 32 | + return $frm_settings->use_html ? 'tel' : 'text'; | |
| 93 | 33 | } |
| 94 | 34 | } |