Development

/branches/1.2/lib/widget/sfWidgetFormInputPassword.class.php

You must first sign up to be able to contribute.

root/branches/1.2/lib/widget/sfWidgetFormInputPassword.class.php

Revision 9046, 1.7 kB (checked in by FabianLange, 6 years ago)

1.1: fixed @param phpdoc to fit specs in widgets (refs #2991)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfWidgetFormInputPassword represents a password HTML input tag.
13  *
14  * @package    symfony
15  * @subpackage widget
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfWidgetFormInputPassword extends sfWidgetFormInput
20 {
21   /**
22    * Configures the current widget.
23    *
24    * Available options:
25    *
26    *  * always_render_empty: true if you want the input value to be always empty when rendering (true by default)
27    *
28    * @param array $options     An array of options
29    * @param array $attributes  An array of default HTML attributes
30    *
31    * @see sfWidgetFormInput
32    */
33   protected function configure($options = array(), $attributes = array())
34   {
35     parent::configure($options, $attributes);
36
37     $this->addOption('always_render_empty', true);
38
39     $this->setOption('type', 'password');
40   }
41
42   /**
43    * @param  string $name        The element name
44    * @param  string $value       The password stored in this widget, will be masked by the browser.
45    * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
46    * @param  array  $errors      An array of errors for the field
47    *
48    * @return string An HTML tag string
49    *
50    * @see sfWidgetForm
51    */
52   public function render($name, $value = null, $attributes = array(), $errors = array())
53   {
54     return parent::render($name, $this->getOption('always_render_empty') ? null : $value, $attributes, $errors);
55   }
56 }
57
Note: See TracBrowser for help on using the browser.