Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.

Commit 35c9a4a

Browse files
committed
support id param in options, issue #67
1 parent a483e1e commit 35c9a4a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: ReCaptcha.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,17 @@ protected function buildDivOptions()
243243
$divOptions['class'] = "{$divOptions['class']} {$this->widgetOptions['class']}";
244244
}
245245
$divOptions['input-id'] = $this->getReCaptchaId();
246-
$divOptions['form-id'] = (isset($this->field) && $this->field->form !== null) ? $this->field->form->id : '';
246+
247+
if ($this->field !== null && $this->field->form !== null) {
248+
if (!empty($this->field->form->options['id'])) {
249+
$divOptions['form-id'] = $this->field->form->options['id'];
250+
} else {
251+
$divOptions['form-id'] = $this->field->form->id;
252+
}
253+
} else {
254+
$divOptions['form-id'] = '';
255+
}
256+
247257
$divOptions['id'] = $this->getReCaptchaId() . '-recaptcha' .
248258
($divOptions['form-id'] ? ('-' . $divOptions['form-id']) : '');
249259

0 commit comments

Comments
 (0)