RegexPhoneOption.php
| 1 | <?php |
| 2 | |
| 3 | namespace WPDesk\FCF\Free\Settings\Option; |
| 4 | |
| 5 | use WPDesk\FCF\Free\Settings\Tab\AdvancedTab; |
| 6 | |
| 7 | /** |
| 8 | * {@inheritdoc} |
| 9 | */ |
| 10 | class RegexPhoneOption extends OptionAbstract { |
| 11 | |
| 12 | const FIELD_NAME = 'validation_regex'; |
| 13 | |
| 14 | /** |
| 15 | * {@inheritdoc} |
| 16 | */ |
| 17 | public function get_option_name(): string { |
| 18 | return self::FIELD_NAME; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * {@inheritdoc} |
| 23 | */ |
| 24 | public function get_option_tab(): string { |
| 25 | return AdvancedTab::TAB_NAME; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * {@inheritdoc} |
| 30 | */ |
| 31 | public function get_option_type(): string { |
| 32 | return self::FIELD_TYPE_TEXT; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * {@inheritdoc} |
| 37 | */ |
| 38 | public function get_option_label(): string { |
| 39 | return __( 'Validation regex', 'flexible-checkout-fields' ); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * {@inheritdoc} |
| 44 | */ |
| 45 | public function get_label_tooltip(): string { |
| 46 | return __( 'Enter the number format using the regex code. Our documentation contains sample formats.', 'flexible-checkout-fields' ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * {@inheritdoc} |
| 51 | */ |
| 52 | public function get_label_tooltip_url(): string { |
| 53 | return apply_filters( 'flexible_checkout_fields/short_url', '#', 'fcf-settings-phone-validation-regex' ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * {@inheritdoc} |
| 58 | */ |
| 59 | public function sanitize_option_value( $field_value ) { |
| 60 | return sanitize_text_field( $field_value ); |
| 61 | } |
| 62 | } |
| 63 |