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

Commit

Permalink
support id param in options, issue #67
Browse files Browse the repository at this point in the history
  • Loading branch information
himiklab committed Apr 3, 2018
1 parent a483e1e commit 35c9a4a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ReCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,17 @@ protected function buildDivOptions()
$divOptions['class'] = "{$divOptions['class']} {$this->widgetOptions['class']}";
}
$divOptions['input-id'] = $this->getReCaptchaId();
$divOptions['form-id'] = (isset($this->field) && $this->field->form !== null) ? $this->field->form->id : '';

if ($this->field !== null && $this->field->form !== null) {

This comment has been minimized.

Copy link
@dzandrey

dzandrey Apr 20, 2018

Need to add property "field" to this Class.
error message:
Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: himiklab\yii2\recaptcha\ReCaptcha::field

This comment has been minimized.

Copy link
@himiklab

himiklab Apr 20, 2018

Author Owner

field contained in yii\widgets\InputWidget

This comment has been minimized.

Copy link
@dzandrey

dzandrey Apr 20, 2018

this property added in version 2.0.11.
In my version 2.0.10 this property is absent
Please fix it or add the requirements to composer file.

if (!empty($this->field->form->options['id'])) {
$divOptions['form-id'] = $this->field->form->options['id'];
} else {
$divOptions['form-id'] = $this->field->form->id;
}
} else {
$divOptions['form-id'] = '';
}

$divOptions['id'] = $this->getReCaptchaId() . '-recaptcha' .
($divOptions['form-id'] ? ('-' . $divOptions['form-id']) : '');

Expand Down

0 comments on commit 35c9a4a

Please sign in to comment.