2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2007-09-15 23:38:05 +02:00
|
|
|
* Password input field.
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-formattedinput
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
2011-12-21 17:35:42 +01:00
|
|
|
class PasswordField extends TextField {
|
2007-09-15 23:38:05 +02:00
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
/**
|
2007-09-15 23:38:05 +02:00
|
|
|
* Returns an input field, class="text" and type="text" with an optional
|
|
|
|
* maxlength
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
2012-01-02 17:45:47 +01:00
|
|
|
function __construct($name, $title = null, $value = "") {
|
|
|
|
if(count(func_get_args()) > 3) Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments');
|
|
|
|
|
2007-09-15 23:38:05 +02:00
|
|
|
parent::__construct($name, $title, $value);
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
2007-09-15 23:38:05 +02:00
|
|
|
|
|
|
|
|
2011-12-22 13:10:57 +01:00
|
|
|
function getAttributes() {
|
|
|
|
return array_merge(
|
|
|
|
parent::getAttributes(),
|
|
|
|
array('type' => 'password')
|
|
|
|
);
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
2007-09-15 23:38:05 +02:00
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
/**
|
2007-09-15 23:38:05 +02:00
|
|
|
* Makes a pretty readonly field with some stars in it
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
function performReadonlyTransformation() {
|
2007-09-15 23:38:05 +02:00
|
|
|
$stars = '*****';
|
|
|
|
|
|
|
|
$field = new ReadonlyField($this->name, $this->title ? $this->title : '', $stars);
|
2007-07-19 12:40:28 +02:00
|
|
|
$field->setForm($this->form);
|
2008-08-12 04:58:48 +02:00
|
|
|
$field->setReadonly(true);
|
2007-07-19 12:40:28 +02:00
|
|
|
return $field;
|
|
|
|
}
|
2011-12-22 13:10:57 +01:00
|
|
|
|
|
|
|
function Type() {
|
|
|
|
return 'text password';
|
|
|
|
}
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
2007-09-15 23:38:05 +02:00
|
|
|
|
2009-02-02 00:49:53 +01:00
|
|
|
?>
|