18
2009
Correction Element Captcha
Pour ce début de week-end, je vais vous faire partager une correction de Zend_FormElement_Captcha pour la mise en forme avec un tableau (via les décorateurs).
Je redéfinis juste la fonction render() de Zend_Form_Element_Captcha. Voici donc la correction apportée:
| PHP | | copy code | | ? |
| 01 | /** |
| 02 | * Classe d'extension de Zend_Form_Element_Captcha |
| 03 | * |
| 04 | * Corrige un bug par rapport au décorateur du captcha. |
| 05 | * |
| 06 | */ |
| 07 | class App_Form_Element_Captcha extends Zend_Form_Element_Captcha { |
| 08 | |
| 09 | public function render(Zend_View_Interface $view = null) |
| 10 | { |
| 11 | $captcha = $this->getCaptcha(); |
| 12 | $captcha->setName($this->getFullyQualifiedName()); |
| 13 | |
| 14 | $decorators = $this->getDecorators(); |
| 15 | |
| 16 | $decorator = $captcha->getDecorator(); |
| 17 | if (!empty($decorator)) { |
| 18 | array_unshift($decorators, $decorator); |
| 19 | } |
| 20 | |
| 21 | $decorator = array('Captcha', array('captcha' => $captcha)); |
| 22 | array_unshift($decorators, $decorator); |
| 23 | |
| 24 | $this->setDecorators($decorators); |
| 25 | |
| 26 | $this->setValue($this->getCaptcha()->generate()); |
| 27 | |
| 28 | return ''.parent::render($view).''; |
| 29 | } |
| 30 | } |
Et son utilisation pour modifier le décorateur:
| PHP | | copy code | | ? |
| 1 | $captcha->setDecorators(array( |
| 2 | array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), |
| 3 | array('Label', array('tag' => 'td')) |
| 4 | )); |
Articles Connexes
Laisser un commentaire
Catégories
- Actualités (11)
- Android (5)
- Bases de Données (4)
- Développement (1)
- PasteQR (2)
- PHP (8)
- Systèmes et Réseau (5)
- Technologies Web (5)
- Tests (2)
- Zend Framework (30)
Commentaires récents
- (@Fritte7) (@Fritte7) dans PasteQR passe en 1.1.0
- roux dans ZendX Jquery Dialog
- Fritte7 dans Gérer des évènements dans une listview.
- Fierfeu dans Introduction à Zend Framework 2.0
- Christophe B. dans Gérer des évènements dans une listview.
Mots-Clefs
Active Directory AJAX Android Apache2 APC Bootstrap Chrome Configuration CSS Eclipse Firefox Google html HTTP Installation Internet Internet Exporer Java Javascript JQuery JQuery UI Linux Mémoire Mac MySQL Navigateur Opera PDO Pear Phing PHP Safari SGBD SMTP SQL Ubuntu View Helper Windows Server XML Zend Cache Zend DB Zend Form Zend Framework ZendX ZF 2.0
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Publié par Throrïn




