From be91fb754d55a5f612a3841de76248b9eee5e8bd Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 28 Apr 2021 20:16:59 +0000 Subject: [PATCH] [CORE] Typo in GSFile and slight Twig weirdness in base template --- src/Core/GSFile.php | 2 +- templates/attachments/show.html.twig | 25 +++++++++++++++++++++++++ templates/base.html.twig | 7 +++++-- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 templates/attachments/show.html.twig diff --git a/src/Core/GSFile.php b/src/Core/GSFile.php index 55dc5d9c61..5bf3b597d9 100644 --- a/src/Core/GSFile.php +++ b/src/Core/GSFile.php @@ -43,7 +43,7 @@ class GSFile bool $is_local = true, int $actor_id = null): Attachment { - Event::handle('HashFile', [$file->getPathname(), &$hash]); + Event::handle('HashFile', [$sfile->getPathname(), &$hash]); // The following properly gets the mimetype with `file` or other // available methods, so should be safe $mimetype = $sfile->getMimeType(); diff --git a/templates/attachments/show.html.twig b/templates/attachments/show.html.twig new file mode 100644 index 0000000000..82d268cd32 --- /dev/null +++ b/templates/attachments/show.html.twig @@ -0,0 +1,25 @@ +{% extends 'left/left.html.twig' %} + +{% block stylesheets %} + {{ parent() }} + + + +{% endblock %} + +{# {% block header %} #} +{# {{ parent() }} #} +{# {% endblock %} #} + +{# {% block left %} #} +{# {{ parent() }} #} +{# {% endblock %} #} + +{% block body %} +
+ yooo +
+{% endblock body %} diff --git a/templates/base.html.twig b/templates/base.html.twig index 4f6dfa7a47..a3be63ff97 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -18,8 +18,11 @@ {% endfor %} {% endblock %} - {% for type, element in handle_event('ShowHeadElements', app.request) %} - <{{type}} rel="{{element['rel']}}" type="{{element['type']}}" href="{{element['href']}}" title="{{element['title']}}"> + {% for arr in handle_event('ShowHeadElements', app.request) %} + {# Only one element, but has dynamic value, can't access it directly #} + {% for type, element in arr %} + <{{type}} rel="{{element['rel']}}" type="{{element['type']}}" href="{{element['href']}}" title="{{element['title']}}"> + {% endfor %} {% endfor %}