File modules/cms/action/template/TemplateShowAction.class.php
Last commit: Sat Mar 19 00:09:47 2022 +0100 dankert Refactoring: Outputs are setting their content-type themself.
1 <?php 2 namespace cms\action\template; 3 use cms\action\Method; 4 use cms\action\RequestParams; 5 use cms\action\TemplateAction; 6 use cms\generator\Producer; 7 use cms\generator\TemplateGenerator; 8 use cms\model\Element; 9 use cms\model\Project; 10 use cms\model\TemplateModel; 11 12 13 class TemplateShowAction extends TemplateAction implements Method { 14 15 public function view() { 16 17 $tplGenerator = new TemplateGenerator( $this->template->templateid, $this->request->getModelId(), Producer::SCHEME_PREVIEW ); 18 19 $this->setContentType($tplGenerator->getMimeType() ); 20 21 // Template should have access to the page properties. 22 // Template should have access to the settings of this node object. 23 $data = []; 24 $data['_page' ] = []; 25 $data['_localsettings'] = []; 26 $data['_settings' ] = []; 27 28 /** @var Element $element */ 29 foreach($this->template->getElements() as $element ) { 30 31 $element->load(); 32 $data[ $element->name ] = $element->getDefaultValue(); 33 } 34 35 $this->setTemplateVar('value',$tplGenerator->generateValue( $data ) ); 36 } 37 }
Downloadmodules/cms/action/template/TemplateShowAction.class.php
History Sat, 19 Mar 2022 00:09:47 +0100 dankert Refactoring: Outputs are setting their content-type themself. Fri, 18 Mar 2022 22:38:42 +0100 dankert Refactoring: Extracted the TemplateGenerator out of the PageGenerator. Sun, 13 Feb 2022 23:35:26 +0100 dankert Refactoring: New class "Response" which stores all output information. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.