Skip to content

Commit 805f417

Browse files
committed
Merge branch 'release/8.2.1'
2 parents 4c89399 + ad2ad1f commit 805f417

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
# v8.2.1
2+
## 12/28/2025
3+
4+
1. [](#bugfix)
5+
* Fix for bad `Twig::setEscaper()` logic
6+
17
# v8.2.0
2-
## 112/27/2025
8+
## 12/27/2025
39

410
1. [](#improved)
5-
- Use new Twig::setEscaper() helper if it exists
11+
- Use new `Twig::setEscaper()` helper if it exists
612
- Automated form none refresh `refresh_nonce` (false by default)
713
1. [](#bugfix)
814
- Fix spacer field [#623](https://github.com/getgrav/grav-plugin-form/pulls/623)

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Form
22
slug: form
33
type: plugin
4-
version: 8.2.0
4+
version: 8.2.1
55
description: Enables forms handling and processing
66
icon: check-square
77
author:

form.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,21 @@ public function onTwigInitialized(): void
375375
new TwigFunction('forms', [$this, 'getForm'])
376376
);
377377

378-
// Grav 1.8+ has setEscaper() helper that handles all Twig versions
378+
// Register yaml escaper for Twig
379379
$twig = $this->grav['twig'];
380380
if (method_exists($twig, 'setEscaper')) {
381+
// Grav 1.8.0-beta.29+ has setEscaper() helper
381382
$twig->setEscaper('yaml', function ($twig, $string, $charset) {
382383
return Yaml::dump($string);
383384
});
385+
} elseif (class_exists('Twig\Runtime\EscaperRuntime')) {
386+
// Grav 1.8.0-beta.1 to .28 with Twig 3.x (no helper yet)
387+
$twig->twig()->getRuntime('Twig\Runtime\EscaperRuntime')->setEscaper(
388+
'yaml',
389+
function ($string, $charset) {
390+
return Yaml::dump($string);
391+
}
392+
);
384393
} else {
385394
// Grav 1.7 with Twig 1.x
386395
$twig->twig()->getExtension(CoreExtension::class)->setEscaper(

0 commit comments

Comments
 (0)