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