File modules/template_engine/components/html/component_hidden/HiddenComponent.class.php

Last commit: Wed Oct 14 22:36:29 2020 +0200	Jan Dankert	Refactoring: Fixed the namespace in component classes, now the are able to be load by the standard autoloader.
1 <?php 2 3 namespace template_engine\components\html\component_hidden; 4 5 use template_engine\components\html\FieldComponent; 6 use template_engine\element\CMSElement; 7 use template_engine\element\Value; 8 use template_engine\element\ValueExpression; 9 10 class HiddenComponent extends FieldComponent 11 { 12 public $default; 13 14 public function createElement() 15 { 16 $input = (new CMSElement('input'))->addAttribute('type','hidden'); 17 $input->addAttribute('name',$this->name); 18 19 if ($this->default) 20 $input->addAttribute('value',$this->default); 21 else 22 $input->addAttribute('value',Value::createExpression(ValueExpression::TYPE_DATA_VAR,$this->name)); 23 24 return $input; 25 } 26 }
Download modules/template_engine/components/html/component_hidden/HiddenComponent.class.php
History 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.