Uncaught PHP Exception Twig\Error\SyntaxError: "Unexpected "thumbnail" tag
dima-gr opened this issue · comments
Matched route "admin_app_media_sonatamediamedia_list".
Uncaught PHP Exception Twig\Error\SyntaxError: "Unexpected "thumbnail" tag (expecting closing tag for the "if" tag defined near line 34)." at /var/www/html/vendor/sonata-project/media-bundle/src/Resources/views/Form/media_widgets.html.twig line 35
trace:
/var/www/html/vendor/sonata-project/media-bundle/src/Resources/views/Form/media_widgets.html.twig:35 {▼
Twig\Parser->subparse($test, bool $dropNeedle = false): Node …
› <div class="pull-left" style="margin-right: 5px">
› {% thumbnail value, 'admin' with {'class': 'img-polaroid media-object'} %}
› </div>
}
version:
"name": "sonata-project/media-bundle",
"version": "4.x-dev",
"source": {
"type": "git",
"url": "https://github.com/sonata-project/SonataMediaBundle.git",
"reference": "7e503807f85a9dc1b6469c7b2454890e43354ed6"
It is not a bug, this is the expected behavior, you should use media_thumbnail function instead.
Well it seems I missed one replacement on media bundle code. It is a bug then
same here - admin_app_media_sonatamediamedia_create
Uncaught PHP Exception Twig\Error\SyntaxError: "Unexpected "path" tag (expecting closing tag for the "block" tag defined near line 36)." at /var/www/html/vendor/sonata-project/media-bundle/src/Resources/views/MediaAdmin/edit.html.twig line 78`
trace:
/var/www/html/vendor/sonata-project/media-bundle/src/Resources/views/MediaAdmin/edit.html.twig:78 {▼
Twig\Parser->subparse($test, bool $dropNeedle = false): Node …
› <th>
› <a href="{% path object, 'reference' %}" target="_blank">reference</a>
› </th>
}
i am override tempaltes and replace
{% thumbnail value, 'admin' with {'class': 'img-polaroid media-object'} %}
with
{{ sonata_thumbnail(value, 'admin', {'class': 'img-polaroid media-object'}) }}
{% path object, name %} with {{ sonata_path(object, name) }}
and it seems to work, but there was another problem if you try to download the file, an error appears -
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "sonata_media_download" as such route does not exist.").
Did you import this routing file: https://github.com/sonata-project/SonataMediaBundle/blob/4.x/src/Resources/config/routing/media.xml
added and it works, thx)
Ok, soon the media tag fixes will be merged to 4.x, it is already fixed on 3.x