Upgrade to 3.5.7

This commit is contained in:
Bastian Allgeier
2021-07-02 11:34:29 +02:00
parent 5358f8885c
commit 62b533a28f
37 changed files with 329 additions and 233 deletions

View File

@@ -6,6 +6,7 @@ use Kirby\Cms\Field;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\NotFoundException;
use Kirby\Toolkit\Collection;
use Kirby\Toolkit\Escape;
use Kirby\Toolkit\Obj;
use Kirby\Toolkit\Properties;
use Kirby\Toolkit\Query;
@@ -102,7 +103,26 @@ class OptionsQuery
$value = $value[$object];
}
return Str::template($value, $data);
$result = Str::template($value, $data);
// escape the default queries for the `text` field
// TODO: remove after default escape implemented for query templates in 3.6
if ($field === 'text') {
$defaults = [
'arrayItem' => '{{ arrayItem.value }}',
'block' => '{{ block.type }}: {{ block.id }}',
'file' => '{{ file.filename }}',
'page' => '{{ page.title }}',
'structureItem' => '{{ structureItem.title }}',
'user' => '{{ user.username }}',
];
if (isset($defaults[$object]) && $value === $defaults[$object]) {
$result = Escape::html($result);
}
}
return $result;
}
/**