Hello everyone,
I am getting the following warning in the Depricated section of the Grav Debugger:
array:4 [
"message" => "Calling "loop" on template "partials/randomimage.html.twig" from template "partials/randomimage.html.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0."
"file" => "/Applications/MAMP/htdocs/grav-admin/user/themes/pauls-theme/templates/partials/randomimage.html.twig"
"line" => 16
"trace" => array:5 [
0 => array:2 [
"file" => "/Applications/MAMP/htdocs/grav-admin/user/themes/pauls-theme/templates/partials/randomimage.html.twig"
"line" => 16
]
1 => array:2 [
"file" => "/Applications/MAMP/htdocs/grav-admin/user/themes/pauls-theme/templates/partials/randomimage.html.twig"
"line" => 13
]
2 => array:2 [
"file" => "/Applications/MAMP/htdocs/grav-admin/user/themes/pauls-theme/templates/partials/base.html.twig"
"line" => 56
]
3 => array:2 [
"file" => "/Applications/MAMP/htdocs/grav-admin/user/themes/pauls-theme/templates/partials/base.html.twig"
"line" => 1
]
4 => array:2 [
"file" => "/Applications/MAMP/htdocs/grav-admin/user/themes/pauls-theme/templates/index.html.twig"
"line" => 1
]
]
]
Does anyone have an idea what I am doing wrong? and how to resolve this?
This is the code I am using.
{% macro loop(page) %}
<div class="random-preview">
{# go through two random pages that are visible #}
{% for p in page.children.visible.random(1) %}
{% if p.header.thumbnail|length > 1 %}
{{ p.media[p.header.thumbnail].html("titel", "alt", "random-image padding") }}
<!-- {% set pic = p.media.images %}
{% set randompic = random(pic) %}
{{ randompic.html("titel", "alt", "random-image padding") }} -->
{% endif %}
{% endfor %}
</div>
{% endmacro %}
{{ _self.loop(pages) }}
Thanks in advance,
EE