diff --git a/phpcs.xml b/phpcs.xml
index ccd4f875..b1c465ed 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -4,6 +4,8 @@
.
+
+ ^(?!.*/hcaptcha-wordpress-plugin).*
*/\.codeception/*
*/\.github/*
*/\.php-scoper/vendor/*
diff --git a/readme.txt b/readme.txt
index 0b99f1ff..2ade231a 100644
--- a/readme.txt
+++ b/readme.txt
@@ -572,6 +572,7 @@ Instructions for popular native integrations are below:
= 4.7.0 =
* Added compatibility with WordPress Recovery Mode.
+* Added compatibility with Contact Form 7 v6.0.
* Added compatibility with Akismet tag in Contact Form 7.
* Added activation and deactivation of plugins network wide if hCaptcha is set network wide.
* Added ability to use shortcode in the Mailchimp for WP form.
diff --git a/src/php/CF7/Admin.php b/src/php/CF7/Admin.php
index db94151b..eccd74fa 100644
--- a/src/php/CF7/Admin.php
+++ b/src/php/CF7/Admin.php
@@ -12,6 +12,7 @@
use HCaptcha\Helpers\Pages;
use WPCF7_TagGenerator;
+use WPCF7_TagGeneratorGenerator;
/**
* Class Admin.
@@ -159,7 +160,8 @@ public function add_tag_generator_hcaptcha(): void {
$tag_generator->add(
'cf7-hcaptcha',
__( 'hCaptcha', 'hcaptcha-for-forms-and-more' ),
- [ $this, 'tag_generator_hcaptcha' ]
+ [ $this, 'tag_generator_hcaptcha' ],
+ [ 'version' => '2' ]
);
}
@@ -167,68 +169,48 @@ public function add_tag_generator_hcaptcha(): void {
* Show tag generator.
*
* @param mixed $contact_form Contact form.
- * @param array|string $args Arguments.
+ * @param array|string $options Options.
*
* @return void
* @noinspection PhpUnusedParameterInspection
*/
- public function tag_generator_hcaptcha( $contact_form, $args = '' ): void {
- $args = wp_parse_args( $args );
- $type = $args['id'];
- $description = __( 'Generate a form-tag for a hCaptcha field.', 'hcaptcha-for-forms-and-more' );
+ public function tag_generator_hcaptcha( $contact_form, $options = '' ): void {
+ $field = [
+ 'display_name' => __( 'hCaptcha field', 'hcaptcha-for-forms-and-more' ),
+ 'heading' => __( 'hCaptcha field form-tag generator', 'hcaptcha-for-forms-and-more' ),
+ 'description' => __( 'Generate a form-tag for a hCaptcha field.', 'hcaptcha-for-forms-and-more' ),
+ ];
+
+ $tgg = new WPCF7_TagGeneratorGenerator( $options['content'] );
?>
+
+
-
+ print(
+ 'field_type',
+ [
+ 'with_required' => true,
+ 'select_options' => [
+ 'cf7-hcaptcha' => $field['display_name'],
+ ],
+ ]
+ );
+ $tgg->print( 'field_name' );
+ $tgg->print( 'class_attr' );
+ ?>
-
+