Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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: sfWidgetFormInputPassword.class.php 30762 2010-08-25 12:33:33Z fabien $
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
   * Renders the widget.
44
   *
45
   * @param  string $name        The element name
46
   * @param  string $value       The password stored in this widget, will be masked by the browser.
47
   * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
48
   * @param  array  $errors      An array of errors for the field
49
   *
50
   * @return string An HTML tag string
51
   *
52
   * @see sfWidgetForm
53
   */
54
  public function render($name, $value = null, $attributes = array(), $errors = array())
55
  {
56
    return parent::render($name, $this->getOption('always_render_empty') ? null : $value, $attributes, $errors);
57
  }
58
}