From 9d03c69f8a3fe8d238553b85a1121115798e0268 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 19 Apr 2024 19:01:35 +0200 Subject: [PATCH] removed {templatePrint} --- .../Nodes/TemplatePrintNode.php | 61 ------------------- src/Bridges/ApplicationLatte/UIExtension.php | 1 - 2 files changed, 62 deletions(-) delete mode 100644 src/Bridges/ApplicationLatte/Nodes/TemplatePrintNode.php diff --git a/src/Bridges/ApplicationLatte/Nodes/TemplatePrintNode.php b/src/Bridges/ApplicationLatte/Nodes/TemplatePrintNode.php deleted file mode 100644 index 151913a07..000000000 --- a/src/Bridges/ApplicationLatte/Nodes/TemplatePrintNode.php +++ /dev/null @@ -1,61 +0,0 @@ -getParameters(), ' . PhpHelpers::dump($this->template ?? Template::class) . '); exit;'; - } - - - public static function printClass(array $params, string $parentClass): void - { - $bp = new Latte\Essential\Blueprint; - if (!method_exists($bp, 'generateTemplateClass')) { - throw new \LogicException("Please update 'latte/latte' to version 3.0.15 or newer."); - } - - $control = $params['control'] ?? $params['presenter'] ?? null; - $name = 'Template'; - if ($control instanceof UI\Control) { - $name = preg_replace('#(Control|Presenter)$#', '', $control::class) . 'Template'; - unset($params[$control instanceof UI\Presenter ? 'control' : 'presenter']); - } - $class = $bp->generateTemplateClass($params, $name, $parentClass); - $code = (string) $class->getNamespace(); - - $bp->printBegin(); - $bp->printCode($code); - - if ($control instanceof UI\Control) { - $file = dirname((new \ReflectionClass($control))->getFileName()) . '/' . $class->getName() . '.php'; - if (file_exists($file)) { - echo "unsaved, file {$bp->clickableFile($file)} already exists"; - } else { - echo "saved to file {$bp->clickableFile($file)}"; - file_put_contents($file, "printEnd(); - exit; - } -} diff --git a/src/Bridges/ApplicationLatte/UIExtension.php b/src/Bridges/ApplicationLatte/UIExtension.php index bc18af2bc..c1f3a7bad 100644 --- a/src/Bridges/ApplicationLatte/UIExtension.php +++ b/src/Bridges/ApplicationLatte/UIExtension.php @@ -74,7 +74,6 @@ public function getTags(): array 'plink' => Nodes\LinkNode::create(...), 'link' => Nodes\LinkNode::create(...), 'ifCurrent' => Nodes\IfCurrentNode::create(...), - 'templatePrint' => Nodes\TemplatePrintNode::create(...), 'snippet' => Nodes\SnippetNode::create(...), 'snippetArea' => Nodes\SnippetAreaNode::create(...), 'layout' => $this->createExtendsNode(...),