Skip to content

Commit

Permalink
Merge pull request #6 from eduardovillao/feature/add-cpf-cnpj-validat…
Browse files Browse the repository at this point in the history
…ion-pro-support

feat: add support to cpf and cnpj validation
  • Loading branch information
eduardovillao authored Jan 14, 2025
2 parents 87aa8a6 + d40ee4a commit 0727482
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ Ready-to-Use Masks
- **Prefix and Suffix Options**: Add prefixes and suffixes to your masks for better input guidance.
- **Minimum and Maximum Character Validation**: Ensure inputs meet your character length requirements.
- **Inputmode Control**: Customize the input type for better usability across devices.

🚀 **Coming Soon to the PRO Version**
- Built-in **validation for CPF, CNPJ**, and other formats.
- And much more…
- **Built-in **validation for CPF, CNPJ**.

**PRO VERSION**
[Check the PRO version here](https://codecanyon.net/item/form-masks-for-elementor/25872641)
Expand Down Expand Up @@ -83,6 +80,10 @@ Yes, but this feature is available only in the PRO version. With the PRO version

## Changelog
```
= 2.2 =
* New: add support to CPF (Brazilian ID) and CNPJ (Brazilian Company ID) validation on pro version.
* Changed: code improvements.
= 2.1 =
* New: support to controls from version Pro.
* Changed: code improvements.
Expand Down
4 changes: 2 additions & 2 deletions form-masks-for-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Form Masks for Elementor create a custom control in field advanced tab for your customize your fields with masks. This plugin require the Elementor Pro (Form Widget).
* Author: EduardoVillao.me
* Author URI: https://eduardovillao.me/
* Version: 2.1
* Version: 2.2
* Requires at least: 5.5
* Requires PHP: 7.4
* Text Domain: form-masks-for-elementor
Expand Down Expand Up @@ -35,7 +35,7 @@

define( 'FME_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'FME_PLUGN_URL', plugin_dir_url( __FILE__ ) );
define( 'FME_VERSION', '2.1' );
define( 'FME_VERSION', '2.2' );
define( 'FME_PHP_MINIMUM_VERSION', '7.4' );
define( 'FME_WP_MINIMUM_VERSION', '5.5' );

Expand Down
23 changes: 23 additions & 0 deletions includes/class-elementor-mask-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,29 @@ public function add_mask_control( $element, $args ) {
],
],
],
'fme_mask_validation_control' => [
'label' => esc_html__( 'Validaiton', 'form-masks-for-elementor' ) . $pro_tag,
'description' => esc_html__( 'Built-in validation ensures accurate input and prevents submission errors.', 'form-masks-for-elementor' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'select',
'options' => [
'select' => esc_html__( 'Select', 'form-masks-for-elementor' ),
'cpf' => esc_html__( 'CPF (Brazilian ID)', 'form-masks-for-elementor' ),
'cnpj' => esc_html__( 'CNPJ (Brazilian Company ID)', 'form-masks-for-elementor' ),
],
'tab' => 'content',
'tabs_wrapper' => 'form_fields_tabs',
'inner_tab' => 'form_fields_advanced_tab',
'conditions' => [
'terms' => [
[
'name' => 'field_type',
'operator' => 'in',
'value' => [ 'text' ],
],
],
],
],
'fme_mask_reverse_control' => [
'label' => esc_html__( 'Mask Reverse?', 'form-masks-for-elementor' ) . $pro_tag,
'description' => esc_html__( 'Reverse mode is to format values dynamically as the user types, starting from the right (e.g., 0.01, 1.23, 12.34). Is commonly used for currency masks where the value grows from the decimal point.', 'form-masks-for-elementor' ),
Expand Down
11 changes: 6 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://eduardovillao.me/
Tags: elementor, elementor form, form mask
Requires at least: 5.5
Tested up to: 6.7
Stable tag: 2.1
Stable tag: 2.2
Requires PHP: 7.4
License: GPLv2License
URI:https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -43,10 +43,7 @@ Ready-to-Use Masks
* **Prefix and Suffix Options**: Add prefixes and suffixes to your masks for better input guidance.
* **Minimum and Maximum Character Validation**: Ensure inputs meet your character length requirements.
* **Inputmode Control**: Customize the input type for better usability across devices.

🚀 **Coming Soon to the PRO Version**
* Built-in **validation for CPF, CNPJ**, and other formats.
* And much more…
* **Built-in **validation for CPF, CNPJ**.

**PRO VERSION**
[Check the PRO version here](https://codecanyon.net/item/form-masks-for-elementor/25872641)
Expand Down Expand Up @@ -98,6 +95,10 @@ Yes, but this feature is available only in the PRO version. With the PRO version

== Changelog ==

= 2.2 =
* New: add support to CPF (Brazilian ID) and CNPJ (Brazilian Company ID) validation on pro version.
* Changed: code improvements.

= 2.1 =
* New: support to controls from version Pro.
* Changed: code improvements.
Expand Down

0 comments on commit 0727482

Please sign in to comment.