LogoComponent.class.php (1116B)
1 <?php 2 3 namespace template_engine\components\html\component_logo; 4 5 use template_engine\components\html\Component; 6 use template_engine\element\CMSElement;use template_engine\element\HtmlElement; 7 use template_engine\element\Value; 8 use template_engine\element\ValueExpression; 9 10 class LogoComponent extends Component 11 { 12 public $name; 13 14 public function createElement() 15 { 16 $logo = (new CMSElement('div'))->addStyleClass('logo'); 17 18 $label = (new HtmlElement('div'))->addStyleClass('logo-icon'); 19 20 $image = (new CMSElement('i'))->addStyleClass(['image-icon','image-icon--method-'.$this->name]); 21 $label->addChild($image); 22 23 $logo->addChild($label); 24 25 $holder = (new HtmlElement('div'))->addStyleClass('logo-description'); 26 $logo->addChild($holder); 27 28 $holder->addChild( (new CMSElement('h2'))->addStyleClass('logo-headline')->content(Value::createExpression( ValueExpression::TYPE_MESSAGE,'logo_'.$this->name ))); 29 $holder->addChild( (new CMSElement('p') )->addStyleClass('logo-text' )->content(Value::createExpression( ValueExpression::TYPE_MESSAGE,'logo_'.$this->name.'_text'))); 30 31 return $logo; 32 } 33 34 }