diff --git a/forms/PasswordField.php b/forms/PasswordField.php index 21ac2e212..c230ee9bf 100644 --- a/forms/PasswordField.php +++ b/forms/PasswordField.php @@ -1,11 +1,12 @@ 3) { - Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments', - Deprecation::SCOPE_GLOBAL); + Deprecation::notice( + '3.0', 'Use setMaxLength() instead of constructor arguments', + Deprecation::SCOPE_GLOBAL + ); } parent::__construct($name, $title, $value); } - + /** + * {@inheritdoc} + */ public function getAttributes() { - $attributes = array_merge( - parent::getAttributes(), - array('type' => 'password') + $attributes = array( + 'type' => 'password', ); $autocomplete = Config::inst()->get('PasswordField', 'autocomplete'); - if (isset($autocomplete)) { - $attributes['autocomplete'] = $autocomplete ? 'on' : 'off'; + + if($autocomplete) { + $attributes['autocomplete'] = 'on'; + } else { + $attributes['autocomplete'] = 'off'; } - return $attributes; + return array_merge( + parent::getAttributes(), + $attributes + ); } /** - * Makes a pretty readonly field with some stars in it + * Creates a read-only version of the field. + * + * @return FormField */ public function performReadonlyTransformation() { $field = $this->castedCopy('ReadonlyField'); + $field->setValue('*****'); - + return $field; } + /** + * {@inheritdoc} + */ public function Type() { return 'text password'; } } -