Skip to content

Commit 4bfa1c2

Browse files
committed
tests: compatibility with Latte master
1 parent adf0050 commit 4bfa1c2

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

tests/Forms.Latte/expected/FormMacros.button.phtml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
2-
%A%
2+
// source: %A%
3+
4+
class Template%a% extends Latte\Template
5+
{
6+
7+
function render()
8+
{
9+
%A%?>
310
<form<?php echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_control["myForm"], array (
411
), FALSE) ?>>
512
<button<?php $_input = $_form["send"]; echo $_input->{method_exists($_input, 'getControlPart')?'getControlPart':'getControl'}()->attributes() ?>>
@@ -12,4 +19,6 @@
1219
><?php echo htmlspecialchars($_input->caption) ?></button>
1320
<?php echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd($_form, FALSE) ?></form>
1421
<?php
15-
}}
22+
}
23+
24+
}

tests/Forms.Latte/expected/FormMacros.formContainer.phtml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<?php
2+
// source: %A%
3+
4+
class Template%a% extends Latte\Template
5+
{
6+
7+
function render()
8+
{
29
%A%
3-
//
4-
// main template
5-
//
610
echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_control["myForm"], []) ?>
711

812
<table>
@@ -23,7 +27,7 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
2327
<th>Checkboxes</th>
2428
<td>
2529
<?php $_formStack[] = $_form; $formContainer = $_form = $_form["cont2"] ?> <ol>
26-
<?php %a% foreach ($formContainer->controls AS $name => $field) { ?>
30+
<?php $%a% foreach ($formContainer->controls AS $name => $field) { ?>
2731
<li><?php $_input = is_object($field) ? $field : $_form[$field]; echo $_input->getControl() ?></li>
2832
<?php $iterations++; } ?> </ol>
2933
<?php $formContainer = $_form = array_pop($_formStack) ?>
@@ -52,4 +56,6 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
5256
<?php echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd($_form) ?>
5357

5458
<?php
55-
%A%
59+
}
60+
61+
}

tests/Forms.Latte/expected/FormMacros.forms.phtml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?php
2+
// source: %A%
3+
4+
class Template%a% extends Latte\Template
5+
{
6+
7+
function render()
8+
{
29
%A%
310
echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_control["myForm"], ['id' => 'myForm', 'class'=>"ajax"]) ?>
411

@@ -7,9 +14,9 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
714

815
<?php $_input = is_object($name) ? $name : $_form[$name]; echo $_input->getControl()->addAttributes(['title' => 'Hello', 'size' => 10]) ?>
916

10-
<?php echo Latte\Runtime\Filters::escapeHtml($_input->getError(), ENT_NOQUOTES) ?>
17+
<?php echo LFilters::escapeHtmlText($_input->getError()) ?>
1118

12-
<?php $_input = is_object($name) ? $name : $_form[$name]; echo Latte\Runtime\Filters::escapeHtml($_input->getError(), ENT_NOQUOTES) ?>
19+
<?php $_input = is_object($name) ? $name : $_form[$name]; echo LFilters::escapeHtmlText($_input->getError()) ?>
1320

1421

1522
<br>
@@ -18,7 +25,7 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
1825
<?php $_input = is_object($form[$name]) ? $form[$name] : $_form[$form[$name]]; echo $_input->getControl()->addAttributes(['title' => 'Hello', 'size' => 10]) ?>
1926
<?php if ($_label) echo $_label->endTag() ?>
2027

21-
<?php $_input = is_object($form[$name]) ? $form[$name] : $_form[$form[$name]]; echo Latte\Runtime\Filters::escapeHtml($_input->getError(), ENT_NOQUOTES) ?>
28+
<?php $_input = is_object($form[$name]) ? $form[$name] : $_form[$form[$name]]; echo LFilters::escapeHtmlText($_input->getError()) ?>
2229

2330
<?php $iterations++; } ?>
2431

@@ -51,7 +58,7 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
5158

5259
<?php %a% foreach ($form['sex']->items as $key => $label) { ?>
5360
<?php if ($_label = $_form["sex"]->getLabelPart($key)) echo $_label->startTag() ?>
54-
<?php echo $_form["sex"]->getControlPart($key) ?> <?php echo Latte\Runtime\Filters::escapeHtml($label, ENT_NOQUOTES) ;if ($_label) echo $_label->endTag() ?>
61+
<?php echo $_form["sex"]->getControlPart($key) ?> <?php echo LFilters::escapeHtmlText($label) ;if ($_label) echo $_label->endTag() ?>
5562

5663
<label title=hello<?php $_input = $_form["sex"]; echo $_input->getLabelPart($key)->addAttributes(array (
5764
'title' => NULL,
@@ -83,7 +90,7 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
8390

8491
<?php %a% foreach ($form['checklist']->items as $key => $label) { ?>
8592
<?php if ($_label = $_form["checklist"]->getLabelPart($key)) echo $_label->startTag() ?>
86-
<?php echo $_form["checklist"]->getControlPart($key) ?> <?php echo Latte\Runtime\Filters::escapeHtml($label, ENT_NOQUOTES) ;if ($_label) echo $_label->endTag() ?>
93+
<?php echo $_form["checklist"]->getControlPart($key) ?> <?php echo LFilters::escapeHtmlText($label) ;if ($_label) echo $_label->endTag() ?>
8794

8895
<label<?php $_input = $_form["checklist"]; echo $_input->getLabelPart($key)->attributes() ?>
8996
> <input title=hello<?php $_input = $_form["checklist"]; echo $_input->getControlPart($key)->addAttributes(array (
@@ -117,13 +124,14 @@ echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $_form = $_contro
117124
><?php echo $_input->getControl()->getHtml() ?></select>
118125

119126

120-
<textarea title="<?php echo Latte\Runtime\Filters::escapeHtml(10, ENT_COMPAT) ?>
121-
"<?php $_input = $_form["area"]; echo $_input->{method_exists($_input, 'getControlPart')?'getControlPart':'getControl'}()->addAttributes(array (
127+
<textarea title="<?php echo LFilters::escapeHtmlAttr(10) ?>"<?php $_input = $_form["area"]; echo $_input->{method_exists($_input, 'getControlPart')?'getControlPart':'getControl'}()->addAttributes(array (
122128
'title' => NULL,
123129
))->attributes() ?>><?php echo $_input->getControl()->getHtml() ?></textarea>
124130

125131

126132
<select<?php $_input = $_form["select"]; echo $_input->{method_exists($_input, 'getControlPart')?'getControlPart':'getControl'}()->attributes() ?>
127133
><?php echo $_input->getControl()->getHtml() ?></select>
128134
<?php
129-
%A%
135+
}
136+
137+
}

0 commit comments

Comments
 (0)