File modules/template_engine/components/html/component_password/PasswordComponent.class.php

Last commit: Wed Feb 15 00:22:28 2023 +0100	Jan Dankert	Fix: Changing the Longtext format was not possible.
1 <?php 2 3 namespace template_engine\components\html\component_password; 4 5 use template_engine\components\html\FieldComponent; 6 use template_engine\element\CMSElement; 7 use template_engine\element\HtmlElement; 8 use template_engine\element\Value; 9 use template_engine\element\ValueExpression; 10 11 class PasswordComponent extends FieldComponent 12 { 13 14 public $default; 15 16 public $size = 40; 17 18 public $maxlength = 256; 19 20 public $minlength; 21 public $required = false; 22 public $hint; 23 24 public function createElement() 25 { 26 $input = (new CMSElement('input'))->addAttribute('type','password'); 27 28 $input->addAttribute('name',$this->name); 29 30 $input->addAttribute('size',$this->size); 31 $input->addAttribute('maxlength',$this->maxlength); 32 33 if ( $this->class ) 34 $input->addStyleClass($this->class); 35 36 if ( $this->required ) 37 $input->addAttribute( 'required','required'); 38 39 if ( $this->hint ) 40 $input->addAttribute( 'placeholder',$this->hint ); 41 42 if ( $this->minlength ) 43 $input->addAttribute('minlength',$this->minlength); 44 45 if ($this->default) 46 $input->addAttribute('value',$this->default); 47 else 48 $input->addAttribute('value',Value::createExpression(ValueExpression::TYPE_DATA_VAR,$this->name)); 49 50 $input->addStyleClass('input')->addStyleClass('input--password'); 51 52 $makeVisible = (new CMSElement('i'))->addStyleClass(['image-icon','image-icon--visible','act-make-visible','btn']); 53 54 return (new CMSElement('span'))->addStyleClass([])->addChild($input)->addChild($makeVisible); 55 } 56 }
Download modules/template_engine/components/html/component_password/PasswordComponent.class.php
History Wed, 15 Feb 2023 00:22:28 +0100 Jan Dankert Fix: Changing the Longtext format was not possible. Tue, 1 Dec 2020 20:28:48 +0100 Jan Dankert New: Doubleclick on password fields will show the password. Tue, 1 Dec 2020 00:07:39 +0100 Jan Dankert New: Visibility-Button for password fields, fix: QR-code button for mobile devices. Tue, 20 Oct 2020 22:10:15 +0200 Jan Dankert New form layout. Wed, 14 Oct 2020 22:36:29 +0200 Jan Dankert Refactoring: Fixed the namespace in component classes, now the are able to be load by the standard autoloader. Wed, 14 Oct 2020 22:20:22 +0200 Jan Dankert Refactoring: Renamed component folders, because 'if' is no valid namespace fragment.