From 397e38b7a6e99f689689b5bfa953b63ebf682b7b Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 27 Dec 2022 01:37:19 +0100 Subject: [PATCH] Latte: NNameNode split to two classes --- src/Bridges/FormsLatte/FormsExtension.php | 4 +- .../{NNameNode.php => FieldNNameNode.php} | 43 ++-------- .../FormsLatte/Nodes/FormNNameNode.php | 80 +++++++++++++++++++ 3 files changed, 89 insertions(+), 38 deletions(-) rename src/Bridges/FormsLatte/Nodes/{NNameNode.php => FieldNNameNode.php} (69%) create mode 100644 src/Bridges/FormsLatte/Nodes/FormNNameNode.php diff --git a/src/Bridges/FormsLatte/FormsExtension.php b/src/Bridges/FormsLatte/FormsExtension.php index e481544cc..3e13a0b88 100644 --- a/src/Bridges/FormsLatte/FormsExtension.php +++ b/src/Bridges/FormsLatte/FormsExtension.php @@ -28,7 +28,9 @@ public function getTags(): array 'inputError' => [Nodes\InputErrorNode::class, 'create'], 'formPrint' => [Nodes\FormPrintNode::class, 'create'], 'formClassPrint' => [Nodes\FormPrintNode::class, 'create'], - 'n:name' => [Nodes\NNameNode::class, 'create'], + 'n:name' => fn(Latte\Compiler\Tag $tag) => yield from strtolower($tag->htmlElement->name) === 'form' + ? Nodes\FormNNameNode::create($tag) + : Nodes\FieldNNameNode::create($tag), ]; } diff --git a/src/Bridges/FormsLatte/Nodes/NNameNode.php b/src/Bridges/FormsLatte/Nodes/FieldNNameNode.php similarity index 69% rename from src/Bridges/FormsLatte/Nodes/NNameNode.php rename to src/Bridges/FormsLatte/Nodes/FieldNNameNode.php index 5a6867bae..78ce293a6 100644 --- a/src/Bridges/FormsLatte/Nodes/NNameNode.php +++ b/src/Bridges/FormsLatte/Nodes/FieldNNameNode.php @@ -9,7 +9,6 @@ namespace Nette\Bridges\FormsLatte\Nodes; -use Latte; use Latte\Compiler\Nodes\AreaNode; use Latte\Compiler\Nodes\AuxiliaryNode; use Latte\Compiler\Nodes\Html\AttributeNode; @@ -24,9 +23,9 @@ /** - *
, ,