Merge branch '1.7' of github.com:getgrav/grav into 1.7

This commit is contained in:
Andy Miller
2020-10-18 15:07:19 -06:00
5 changed files with 12 additions and 4 deletions

View File

@@ -11,6 +11,7 @@
* Accessing page with unsupported file extension (jpg, pdf, xsl) will use wrong mime type [#3031](https://github.com/getgrav/grav/issues/3031)
* Fixed media crashing on a bad image
* Fixed bug in collections where filter `type: false` did not work
* Fixed `print_r()` in twig
# v1.7.0-rc.17
## 10/07/2020

View File

@@ -232,7 +232,7 @@
### Templating
* Added support for Twig 2.12 (still using Twig 1.42)
* Added support for Twig 2.12 (using Twig 1.43)
* Added a new `{% cache %}` Twig tag eliminating need for `twigcache` extension.
* Added `array_diff()` twig function
* Added `template_from_string()` twig function

View File

@@ -21,13 +21,13 @@ languages:
default_lang: # Default is the first supported language. Must be one of the supported languages
include_default_lang: true # Include the default lang prefix in all URLs
include_default_lang_file_extension: true # If true, include language code for the default language in file extension: default.en.md
pages_fallback_only: false # Only fallback to find page content through supported languages
translations: true # If false, translation keys are used instead of translated strings
translations_fallback: true # Fallback through supported translations if active lang doesn't exist
session_store_active: false # Store active language in session
http_accept_language: false # Attempt to set the language based on http_accept_language header in the browser
override_locale: false # Override the default or system locale with language specific one
content_fallback: {} # Custom language fallbacks. eg: {fr: ['fr', 'en']}
pages_fallback_only: false # DEPRECATED: Use `content_fallback` instead
home:
alias: '/home' # Default path for home, ie /

View File

@@ -414,6 +414,8 @@ class Language
$fallback_languages = [];
if (null === $fallback && $this->config->get('system.languages.pages_fallback_only', false)) {
user_error('Configuration option `system.languages.pages_fallback_only` is deprecated since Grav 1.7, use `system.languages.content_fallback` instead', E_USER_DEPRECATED);
// Special fallback list returns itself and all the previous items in reverse order:
// active: 'v2', languages: ['v1', 'v2', 'v3', 'v4'] => ['v2', 'v1', '']
if ($includeDefault) {

View File

@@ -140,7 +140,7 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
new TwigFilter('array_unique', 'array_unique'),
new TwigFilter('basename', 'basename'),
new TwigFilter('dirname', 'dirname'),
new TwigFilter('print_r', 'print_r'),
new TwigFilter('print_r', [$this, 'print_r']),
new TwigFilter('yaml_encode', [$this, 'yamlEncodeFilter']),
new TwigFilter('yaml_decode', [$this, 'yamlDecodeFilter']),
new TwigFilter('nicecron', [$this, 'niceCronFilter']),
@@ -181,7 +181,7 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
new TwigFunction('debug', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]),
new TwigFunction('dump', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]),
new TwigFunction('vardump', [$this, 'vardumpFunc']),
new TwigFunction('print_r', 'print_r'),
new TwigFunction('print_r', [$this, 'print_r']),
new TwigFunction('http_response_code', 'http_response_code'),
new TwigFunction('evaluate', [$this, 'evaluateStringFunc'], ['needs_context' => true]),
new TwigFunction('evaluate_twig', [$this, 'evaluateTwigFunc'], ['needs_context' => true]),
@@ -241,6 +241,11 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
];
}
public function print_r($var)
{
return print_r($var, true);
}
/**
* Filters field name by changing dot notation into array notation.
*