Blog Article Files¶
blog_article_files
module is used to display a tile grid of files associated with a currently viewed blog article.
Configuration parameters¶
displayTitle¶
int
if set to 1 the title will be displayed.
title¶
string
title of the module
showTitleDescription¶
int
if set to 1 the title description will be displayed.
description¶
string
additional description of the module displayed below the title
Module source code¶
{% from "@macros/file_box.twig" import file_box %}
{% from "@macros/module_accordion_toggler.twig" import module_accordion_toggler %}
{% set article = ObjectApi.getBlogArticle(news_id) %}
{% set articleSettings = ObjectApi.getBlogSettings(news_id) %}
{% set shopUrls = ObjectApi.getShopUrls() %}
{% set hasTitle = moduleConfig.displayTitle and moduleConfig.title %}
{% if not article.files|length == 0 and articleSettings.isFilesDownloadEnabled %}
{% if not articleSettings.canAnyoneDownload %}
<auth-controller hidden>
{% endif %}
<div class="blog-article-files" {% if not blogSettings.canAnyoneComment %} slot="logged-in" {% endif %}>
<h-accordion class="accordion" disabled>
<h-accordion-group opened>
{% if hasTitle %}
<h2 class="module__header blog-article-files__header">
{{ module_accordion_toggler({ title: moduleConfig.title, isDisabled: true }) }}
</h2>
{% endif %}
<h-accordion-content>
{% if moduleConfig.showTitleDescription and moduleConfig.description %}
<div class="grid__col grid__col_xs-12 grid__col_md-10">
<span class="module__description">{{ moduleConfig.description }}</span>
</div>
{% endif %}
<div class="blog-article-files__files-section tile-grid tile-grid_sm-2 tile-grid_xl-3">
{% for file in article.files %}
{{
file_box(file)
}}
{% endfor %}
</div>
</h-accordion-content>
</h-accordion-group>
</h-accordion>
</div>
{% if not articleSettings.canAnyoneDownload %}
</auth-controller>
{% endif %}
{% endif %}
<script type="application/ld+json">
{
"@context": [
"http://schema.org/",
{ "@base": "{{ shopUrls.mainPageUrl.absolute }}" }
],
"@id": "{{ article.url.relative }}",
"@type": "Article",
"associatedMedia": {
"@context": "https://schema.org",
"@type": "MediaObject",
"contentSize": "{{ (article.files|first).size.humanReadable }}",
"contentUrl": "{{ (article.files|first).url.relative }}",
"description": "{{ (article.files|first).description }}",
"encodingFormat": "{{ (article.files|first).extension }}",
"name": "{{ (article.files|first).name }}"
}
}
</script>
Macros reference¶
Used Object Api methods¶
Used styles¶
Module configuration schema¶
[
{
"state": "unfolded",
"label": "General settings",
"elements": [
{
"type": "infobox",
"name": "infobox",
"options": {
"type": "blank",
"message": "#### Related settings in the admin panel%s- changing phrases in [translations](%s)%s- hiding downloads for users that are not logged in in [blog settings](%s)",
"placeholderValues": [
"\n",
"\/admin\/configLanguages\/list",
"\n",
"\/admin\/configBlog"
]
}
},
{
"type": "checkbox",
"name": "displayTitle",
"label": "Display module title",
"defaultValue": 1,
"children": [
{
"type": "text",
"name": "title",
"label": "Module title",
"defaultValue": "Files to download",
"supportsTranslations": 1,
"isRequired": 1,
"relations": [
{
"parentName": "displayTitle",
"parentValueToActionsMap": [
{
"value": 1,
"actions": ["setVisibleAndRequired", "setAvailable"]
},
{
"value": 0,
"actions": ["setHiddenAndOptional", "setDisabled"]
}
]
}
]
}
]
},
{
"type": "checkbox",
"name": "showTitleDescription",
"label": "Display additional description below the module title",
"defaultValue": 0,
"children": [
{
"type": "textarea",
"name": "description",
"label": "Description",
"supportsTranslations": 1,
"relations": [
{
"parentName": "showTitleDescription",
"parentValueToActionsMap": [
{
"value": 1,
"actions": ["setVisible", "setAvailable"]
},
{
"value": 0,
"actions": ["setHidden", "setDisabled"]
}
]
}
]
}
]
}
]
}
]