Reputation:
I am using Zend_Service_ReCaptcha in a project and wish to customize the colour scheme of the box, however I am completely stumped on which function to use to achieve this. http://framework.zend.com/manual/en/zend.form.standardElements.html#zend.form.standardElements.captcha doesn't seem to shed any light.
Answers are appreciated, thanks.
Upvotes: 4
Views: 2641
Reputation:
You get the public and private keys when you register at http://recaptcha.net/ and set them in your form as follows $recaptcha_service = new Zend_Service_ReCaptcha($public, $private);
Upvotes: 0
Reputation: 656
Setting this options via form element params won't work! This options (“theme” and “lang”) should be passed to the service instead!
Here's Zend_Service_ReCaptcha constructor:
public function __construct($publicKey = null, $privateKey = null,
$params = null, $options = null, $ip = null)
{
…
Usage:
$options = array('theme' => 'white', 'lang' => 'ru');
$recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey, null, $options);
$this->view->recaptcha = $recaptcha->getHtml();
Otherwise, if you wanna use form elements, you should get service object first. Try something like that:
$options = array('theme' => 'white', 'lang' => 'ru');
$form->getElement('captcha')->getCaptcha()->getService()->setOptions($options);
Upvotes: 8
Reputation: 58361
You need to pass the theme option via the captcha options to the form element:
Something like:
$element = new Zend_Form_Element_Captcha('foo', array(
'label' => "Please verify you're a human",
'captcha' => array(
'captcha' => 'Recaptcha',
'timeout' => 300,
'theme' => 'red'
),
));
Upvotes: 3