Closed foxycode closed 8 months ago
I did not have enough time to test it on my own. Could you please try that?
@hrach Already tried, working with master
thx
the last-minute question, did you try also macros or only the renderer? thx
I have them installed in config, but not sure if they are used
Looks like the macros are no longer setting classes properly. This is how the macros example looks on the master branch:
Compared to a7996ba44ad9eea92e1aa66c53d1e323a6a3f5cc:
If you have any idea what's wrong, please send PR. I have one project I need to update so when I get to it, I'll fix it here as well. But not soon enough.
Looks like the example was never updated to use the new extension, it would require this:
--- a/examples/lattemacros/config.neon
+++ b/examples/lattemacros/config.neon
@@ -4,8 +4,9 @@ application:
*: NextrasDemos\FormsRendering\LatteMacros\*Module\*Presenter
latte:
- macros:
- - Nextras\FormsRendering\LatteMacros\Bs3InputMacros::install
+ extensions:
+ - Nextras\FormsRendering\LatteTags\Bs3\Bs3FormsExtension
+
services:
routing.router: Nette\Application\Routers\SimpleRouter('LatteMacros:default')
But then the extension will still do nothing because input
and label
from Nette\Bridges\FormsLatte\FormsExtension
will take precedence. So we will probably need to use a different name:
--- a/examples/lattemacros/LatteMacrosPresenter.latte
+++ b/examples/lattemacros/LatteMacrosPresenter.latte
@@ -14,54 +14,54 @@
<hr>
{form form class => form-horizontal}
<div class="form-group">
- {label text class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input text}{inputError text}</div>
+ {bsLabel text class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput text}{inputError text}</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">
<div class="checkbox">
- {label checkbox}{input checkbox}{/label}
+ {bsLabel checkbox}{bsInput checkbox}{/bsLabel}
</div>
{inputError checkbox}
</div>
</div>
<div class="form-group">
- {label checkbox_list class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input checkbox_list}{inputError checkbox_list}</div>
+ {bsLabel checkbox_list class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput checkbox_list}{inputError checkbox_list}</div>
</div>
<div class="form-group">
- {label integer class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input integer}{inputError integer}</div>
+ {bsLabel integer class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput integer}{inputError integer}</div>
</div>
<div class="form-group">
- {label multi_select class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input multi_select}{inputError multi_select}</div>
+ {bsLabel multi_select class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput multi_select}{inputError multi_select}</div>
</div>
<div class="form-group">
- {label password class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input password}{inputError password}</div>
+ {bsLabel password class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput password}{inputError password}</div>
</div>
<div class="form-group">
- {label radio_list class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input radio_list}{inputError radio_list}</div>
+ {bsLabel radio_list class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput radio_list}{inputError radio_list}</div>
</div>
<div class="form-group">
- {label select class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input select}{inputError select}</div>
+ {bsLabel select class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput select}{inputError select}</div>
</div>
<div class="form-group">
- {label textarea class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input textarea}{inputError textarea}</div>
+ {bsLabel textarea class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput textarea}{inputError textarea}</div>
</div>
<div class="form-group">
- {label multi_upload class => "label-control col-sm-3" /}
- <div class="col-sm-9">{input multi_upload}{inputError multi_upload}</div>
+ {bsLabel multi_upload class => "label-control col-sm-3" /}
+ <div class="col-sm-9">{bsInput multi_upload}{inputError multi_upload}</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">
- {input save class => btn-primary}
- {input secondary class => btn-default}
+ {bsInput save class => btn-primary}
+ {bsInput secondary class => btn-default}
</div>
</div>
{/form}
--- a/src/LatteTags/Bs3/Bs3FormsExtension.php
+++ b/src/LatteTags/Bs3/Bs3FormsExtension.php
@@ -17,8 +17,8 @@ class Bs3FormsExtension extends Extension
public function getTags(): array
{
return [
- 'label' => [Bs3LabelNode::class, 'create'],
- 'input' => [Bs3InputNode::class, 'create'],
+ 'bsLabel' => [Bs3LabelNode::class, 'create'],
+ 'bsInput' => [Bs3InputNode::class, 'create'],
];
}
}
And if we change it like above, the template compilation will crash due to the use of .var
, which is not supported:
https://github.com/nette/latte/blob/v3.0.5/src/Latte/Compiler/PrintContext.php#L124-L130
Okay, managed to resolve it in #12.
Closing as everything is merged now.
Thanks. Do you plan to release a new version?
I see support is already commited. Can you please release new version?