Vote Details for "HTML_QuickForm2_Captcha" by mansion

» Details
  • Voter: Bertrand Mansion 
  • Vote: +1 (not conditional)
  • Reviews: Deep source review
» Comment
Here are some suggestions:

You can fill $this->data defaults in the properties of your class instead of the constructor since you are just extending Input that does nothing with them. (Like what you did for attributes).

$sessionPrefix could be set using the $data parameter.

The question should probably be the label ->setLabel()

Or maybe you should extend Container instead (my recommandation if you find a way to do that, it's more flexible because then you can use the dom like api to change the elements) and use $this->addStatic() and $this->addText() depending on the elements you want to add.
I don't think it is a very good idea to add a div around these elements, this should probably be left to the renderer.

If you use a Container, you can also use $attributes in the constructor instead of $this->data['captchaHtmlAttributes']. Remember that all the elements extend HTML_Common2 that has utility methods to deal with attributes.

Recaptcha doesn't seem to need a session, maybe you should treat it as a totally different element on its own instead of a subclass of Captcha.

Nevertheless, it is all useful as is, good work.