File modules/template_engine/components/html/component_set/SetComponent.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_set; 4 5 use template_engine\components\html\Component; 6 use template_engine\element\PHPBlockElement; 7 use template_engine\element\Value; 8 9 class SetComponent extends Component 10 { 11 public $var; 12 public $value; 13 public $key; 14 15 16 public function createElement() 17 { 18 $set = new PHPBlockElement(); 19 20 if ($this->value) 21 { 22 if ($this->key) 23 $set->inBlock = '$'.$set->varname($this->var).'= '.$set->value($this->value).'['.((new Value($this->key))->render(Value::CONTEXT_PHP)).'];'; 24 else 25 $set->inBlock = '$'.$set->varname($this->var).'= '.$set->value($this->value).';'; 26 } 27 else { 28 // Unset 29 $set->inBlock = 'unset($'.$set->varname($this->var).')'; 30 } 31 32 return $set; 33 } 34 }
Downloadmodules/template_engine/components/html/component_set/SetComponent.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.