Skip to content

Commit

Permalink
Fix fatal error with Gravity Forms.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Jul 9, 2024
1 parent 6773514 commit 3bca9a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ Instructions for popular native integrations are below:
= 4.3.1 =
* Added a live form in the Contact Form 7 admin form view.
* Fixed warnings and deprecation messages in admin when CF7 is active.
* Fixed fatal error with Gravity Forms.

= 4.3.0 =
* NOTE: the plugin has been renamed from "hCaptcha for WordPress" to "hCaptcha for WP"
Expand Down
21 changes: 16 additions & 5 deletions src/php/GravityForms/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,21 @@ public function add_to_field_groups( array $field_groups ): array {
* Get form editor field title.
*
* @return string
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function get_form_editor_field_title(): string {
public function get_form_editor_field_title() {
return esc_attr( 'hCaptcha' );
}

/**
* Returns the field's form editor description.
*
* @return string
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function get_form_editor_field_description(): string {
public function get_form_editor_field_description() {
return (
esc_attr__(
'Adds a hCaptcha field to your form to help protect your website from spam and bot abuse.',
Expand All @@ -144,17 +148,21 @@ public function get_form_editor_field_description(): string {
* This could be an icon url or a gform-icon class.
*
* @return string
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function get_form_editor_field_icon(): string {
public function get_form_editor_field_icon() {
return HCAPTCHA_URL . '/assets/images/hcaptcha-icon-black-and-white.svg';
}

/**
* Get field settings.
*
* @return array
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function get_form_editor_field_settings(): array {
public function get_form_editor_field_settings() {
return [
'label_placement_setting',
'description_setting',
Expand All @@ -172,8 +180,11 @@ public function get_form_editor_field_settings(): array {
* @return string
* @noinspection PhpCastIsUnnecessaryInspection
* @noinspection PhpUnusedParameterInspection
* @noinspection PhpMissingParamTypeInspection
* @noinspection PhpMissingReturnTypeInspection
* @noinspection ReturnTypeCanBeDeclaredInspection
*/
public function get_field_input( array $form, $value = '', $entry = null ): string {
public function get_field_input( $form, $value = '', $entry = null ) {
$form_id = (int) $form['id'];
$is_entry_detail = $this->is_entry_detail();
$is_form_editor = $this->is_form_editor();
Expand Down

0 comments on commit 3bca9a5

Please sign in to comment.