File modules/cms/action/template/TemplateEditAction.class.php
Last commit: Sat Oct 17 02:16:28 2026 +0200 Jan Dankert Refactoring: Removed empty view() and post() methods; OpenAPI cleanup, removed these unused paths.
1 <?php 2 namespace cms\action\template; 3 use cms\action\Method; 4 use cms\action\TemplateAction; 5 use cms\action\UiOutClass; 6 use cms\api\Model; 7 use cms\api\Template; 8 use cms\model\Element; 9 use cms\model\Project; 10 use cms\model\TemplateModel; 11 12 13 /** 14 * Overall template information. 15 */ 16 class TemplateEditAction extends TemplateAction implements Method { 17 18 /** 19 * Get all template information. 20 * @return Template 21 * @throws \util\exception\ObjectNotFoundException 22 */ 23 #[UiOutClass(Template::class)] 24 public function view(): object 25 { 26 $apiTemplate = new Template( 27 $this->template->getId(), 28 array(), 29 array(), 30 ); 31 32 // Elemente laden 33 foreach( $this->template->getElementIds() as $elid ) 34 { 35 $element = new Element( $elid ); 36 $element->load(); 37 38 $apiTemplate->elements[] = new \cms\api\Element( 39 $elid, 40 $element->getName(), 41 $element->label, 42 $element->desc, 43 $element->getTypeName(), 44 $element->typeid ); 45 46 unset( $element ); 47 } 48 49 50 $project = new Project( $this->template->projectid ); 51 52 foreach( $project->getModels() as $modelId => $modelName ) 53 { 54 $templateModel = new TemplateModel( $this->template->templateid, $modelId ); 55 $templateModel->load(); 56 57 $apiTemplate->templateModels[] = new \cms\api\TemplateModel( 58 $modelId, 59 $modelName, 60 $templateModel->getSource(), 61 $templateModel->format 62 ); 63 } 64 65 return $apiTemplate; 66 67 68 } 69 70 }
Downloadmodules/cms/action/template/TemplateEditAction.class.php
History Sat, 17 Oct 2026 02:16:28 +0200 Jan Dankert Refactoring: Removed empty view() and post() methods; OpenAPI cleanup, removed these unused paths. Thu, 15 Oct 2026 01:39:59 +0200 Jan Dankert New: A much better generation of the OpenAPI Interface documents, supports now the UI API Objects. Tue, 13 Oct 2026 22:52:59 +0200 Jan Dankert New: The UI is now able to send hierarchical form data and the server is converting it into an object. This is a very nice feature, because this enables a better OpenAPI interface. Tue, 13 Oct 2026 18:49:59 +0200 Jan Dankert New: Another action which returns an object instead of single output values. This should be the future, but it's a long way to refactore all old action methods... Tue, 13 Oct 2026 00:25:36 +0200 Jan Dankert New: Using Objects as return value in Action methods. With this change the creation of OpenAPI is much easier. This is a POC, the other methods follow from time to time. Sat, 28 Jan 2023 19:10:47 +0100 Jan Dankert New: Templates may be rendered as Mustache, Script and Script template. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.