cdowdy / boltbetterthumbs

Bolt Extension for thumbnails, srcset and picture element using Glide
6 stars 2 forks source link

calling a macro directly via _self.macro() deprecated in twig 2.x #47

Closed cdowdy closed 7 years ago

cdowdy commented 7 years ago

used https://github.com/cdowdy/boltbetterthumbs/blob/3c33e0cac1788bef2ef3270112a082855d5f7a21/templates/srcset.macros.twig#L18

cdowdy commented 7 years ago

should import it directly like:

{% macro buildImg( sizes, widthDensity, classes, id, dataAttributes, srcset, srcImg, altText ) %}{% spaceless %}
    {% import _self as respAttribs %}

    {# pulls in macros used by both srcset and picture element #}
{% import 'global.macros.twig' as global %}
 {{ global.setID(id) }} {{ global.htmlClasses(classes) }} {{ global.setDataAttrib( dataAttributes ) }}
 {% if widthDensity == 'w' %}{{ respAttribs.sizes(sizes) }}{% endif %} {{ respAttribs.srcset( srcset ) }} {{ global.srcImg( srcImg ) }} {{ global.altText( altText) }}
{% endspaceless %}
{% endmacro buildImg %}
cdowdy commented 7 years ago

fixed cab94297fbd197d1db89ae6c63ab99175e97bd8c