Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit ee57e28

Browse files
committed
Bugfix: allow to customize "data-callback" attribute using Invisible ReCaptcha. Closes #55
1 parent 933da69 commit ee57e28

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/ReCaptchaBuilderInvisible.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ public function htmlFormButton($button_label = 'Submit', ?array $properties = []
5151

5252
$tag_properties = '';
5353

54-
$properties = array_merge($properties, [
55-
'data-sitekey' => $this->api_site_key,
54+
$properties = array_merge([
5655
'data-callback' => 'biscolabLaravelReCaptcha',
56+
], $properties,
57+
[
58+
'data-sitekey' => $this->api_site_key
5759
]);
5860

5961
if (empty($properties['class'])) {

tests/ReCaptchaHelpersInvisibleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testHtmlFormButtonConfiguration()
5858
{
5959
$button_html = htmlFormButton("Inner text", ['id' => 'button_id', 'class' => 'button_class', 'data-sitekey' => 'custom-data-sitekey', 'data-callback' => 'myCallback']);
6060

61-
$this->assertEquals('<button class="button_class g-recaptcha" data-callback="biscolabLaravelReCaptcha" data-sitekey="api_site_key" id="button_id">Inner text</button>', $button_html);
61+
$this->assertEquals('<button class="button_class g-recaptcha" data-callback="myCallback" data-sitekey="api_site_key" id="button_id">Inner text</button>', $button_html);
6262
}
6363

6464
/**

0 commit comments

Comments
 (0)