Yii Recaptcha extension. This simple extension was built to give developers full control over their recaptcha styling via custom theming.
Please see https://developers.google.com/recaptcha/docs/customization.
Yii::setPathOfAlias('YiiRecaptcha',Yii::getPathOfAlias("application.vendor.amnah.yii-recaptcha"));
<?php $this->widget('YiiRecaptcha\Recaptcha', array(
'model' => $model,
'attribute' => 'recaptcha',
'publicKey' => '<recaptcha public key>',
'style' => 'custom',
)); ?>
/**
* The styling of the recaptcha widget, which will decide which function to use
* For example,
* $style = "default" => $this->runDefault();
* $style = "custom" => $this->runCustom();
* @var string
*/
public function rules() {
return array(
...
array('recaptcha', 'required'),
array('recaptcha', 'YiiRecaptcha\RecaptchaValidator', 'privateKey' => '<recaptcha private key>'),
...
);
}
<?php $this->widget('application.extensions.MyRecaptcha', array(...)); ?>
No stable releases.
Comments