Skip to content

Commit aa1d753

Browse files
committed
Allow installing with Latte 3
This relaxes the version bounds so that people can continue to use the renderers after upgrading to Latte 3. I did not really bother fixing the latte macros themselves as they do not really seem to be maintained, only supporting Bootstrap 3. The existing `latte.macros` config key will just be a no-op with Latte 3, so Latte will just switch to the default macro definitions from Nette Forms.
1 parent 2756613 commit aa1d753

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": ">=7.1",
15-
"latte/latte": "^2.5",
15+
"latte/latte": "^2.5 || ^3.0",
1616
"nette/forms": "^3.0",
1717
"nette/utils": "^3.0"
1818
},

examples/lattemacros/LatteMacrosPresenter.latte

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
<div class="container">
1313
<h1>Form LatteMacros rendering</h1>
1414
<hr>
15+
<p class="alert alert-danger" n:if="version_compare(\Latte\Engine::VERSION, '3', '>=')">The macros are currently only supported on Latte 2.</p>
1516
{form form class => form-horizontal}
1617
<div class="form-group">
17-
{label text class => "label-control col-sm-3"}
18+
{label text class => "label-control col-sm-3" /}
1819
<div class="col-sm-9">{input text}{inputError text}</div>
1920
</div>
2021
<div class="form-group">
@@ -27,35 +28,35 @@
2728
</div>
2829

2930
<div class="form-group">
30-
{label checkbox_list class => "label-control col-sm-3"}
31+
{label checkbox_list class => "label-control col-sm-3" /}
3132
<div class="col-sm-9">{input checkbox_list}{inputError checkbox_list}</div>
3233
</div>
3334
<div class="form-group">
34-
{label integer class => "label-control col-sm-3"}
35+
{label integer class => "label-control col-sm-3" /}
3536
<div class="col-sm-9">{input integer}{inputError integer}</div>
3637
</div>
3738
<div class="form-group">
38-
{label multi_select class => "label-control col-sm-3"}
39+
{label multi_select class => "label-control col-sm-3" /}
3940
<div class="col-sm-9">{input multi_select}{inputError multi_select}</div>
4041
</div>
4142
<div class="form-group">
42-
{label password class => "label-control col-sm-3"}
43+
{label password class => "label-control col-sm-3" /}
4344
<div class="col-sm-9">{input password}{inputError password}</div>
4445
</div>
4546
<div class="form-group">
46-
{label radio_list class => "label-control col-sm-3"}
47+
{label radio_list class => "label-control col-sm-3" /}
4748
<div class="col-sm-9">{input radio_list}{inputError radio_list}</div>
4849
</div>
4950
<div class="form-group">
50-
{label select class => "label-control col-sm-3"}
51+
{label select class => "label-control col-sm-3" /}
5152
<div class="col-sm-9">{input select}{inputError select}</div>
5253
</div>
5354
<div class="form-group">
54-
{label textarea class => "label-control col-sm-3"}
55+
{label textarea class => "label-control col-sm-3" /}
5556
<div class="col-sm-9">{input textarea}{inputError textarea}</div>
5657
</div>
5758
<div class="form-group">
58-
{label multi_upload class => "label-control col-sm-3"}
59+
{label multi_upload class => "label-control col-sm-3" /}
5960
<div class="col-sm-9">{input multi_upload}{inputError multi_upload}</div>
6061
</div>
6162
<div class="form-group">

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Form renderers:
1212
- *Bs4Renderer* - renderer for Bootstrap 4 with support for horizontal, vertial and inline mode;
1313
- *Bs5Renderer* - renderer for Bootstrap 5 with support for horizontal, vertial and inline mode;
1414

15-
Latte Macros renderers:
15+
Latte Macros renderers (only for Latte 2):
1616
- *Bs3InputMacros* - modifies Form Macros to add Bootstrap 3 classes automatically;
1717

1818
### Installation
@@ -23,7 +23,7 @@ The best way to install is using [Composer](http://getcomposer.org/):
2323
$ composer require nextras/forms-rendering
2424
```
2525

26-
Register Bs3InputMacros using Nette DI config:
26+
Register Bs3InputMacros using Nette DI config (only for Latte 2):
2727

2828
```yaml
2929
latte:

src/LatteMacros/BaseInputMacros.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
use Nextras;
2020

2121

22+
/**
23+
* Latte macros for Nette\Forms.
24+
* Latte v2 macros for Nette\Forms.
25+
*
26+
* - {input name}
27+
* - {label name /} or {label name}... {/label}
28+
*/
2229
abstract class BaseInputMacros extends MacroSet
2330
{
2431
/**

0 commit comments

Comments
 (0)