Skip to content

Commit b7cb735

Browse files
committed
Use the figure builder component inside the controller classes to generate the pictures.
1 parent e6e7fa6 commit b7cb735

File tree

16 files changed

+278
-239
lines changed

16 files changed

+278
-239
lines changed

‎config/services.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
$galleryCreatorValidExtensions: '%markocupic_gallery_creator.valid_extensions%'
1212
$imageFactory: '@contao.image.factory'
1313
$insertTagParser: '@contao.insert_tag.parser'
14+
$filesStorage: '@contao.filesystem.virtual.files'
1415

1516
Markocupic\GalleryCreatorBundle\:
1617
resource: ../src/
File renamed without changes.

‎contao/templates/component/_album.html.twig‎ renamed to ‎contao/templates/_new/component/_album.html.twig‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{# component/_album.html.twig #}
2+
{% use "@Contao/component/_figure.html.twig" %}
3+
24
{% trans_default_domain 'contao_default' %}
35

46
{% block album_component %}
57

68
<div{{ attrs(album_inner_attributes|default).addClass('gc-album-list-inner') }}>
79
{% block album_figure %}
810
<div{{ attrs(album_figure_attributes|default).addClass('gc-album-list-figure') }}>
9-
{% include "@Contao/component/_figure.html.twig" with {
10-
figure: figure(album.figureUuid, album.figureSize, album.figureOptions)
11-
} %}
11+
{% if album.figure.build|default %}{% with {figure: album.figure.build} %}{{ block('figure_component') }}{% endwith %}{% endif %}
1212
</div>
1313
{% endblock %}
1414

‎contao/templates/component/_album_detail_view.html.twig‎ renamed to ‎contao/templates/_new/component/_album_detail_view.html.twig‎

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% use "@Contao/component/_list.html.twig" %}
2+
13
{# component/_album_detail_view.html.twig #}
24
{% trans_default_domain 'contao_default' %}
35

@@ -60,27 +62,12 @@
6062
{% endif %}
6163
{% endblock %}
6264

63-
{% block album_detail_pagination %}
64-
{{ detailPagination|raw }}
65-
{% endblock %}
66-
67-
{% block album_detail_picture_list %}
68-
{% if arrPictures %}
69-
{% set album_detail_picture_list_tag_name = album_detail_picture_list_tag_name|default('ul') %}
70-
{% set album_detail_picture_list_item_tag_name = album_detail_picture_list_item_tag_name|default('li') %}
71-
72-
<{{ album_detail_picture_list_tag_name }}{{ attrs(album_detail_picture_list_attributes|default).addClass('gc-album-detail-picture-list') }}>
73-
{% for picture in arrPictures %}
74-
<{{ album_detail_picture_list_item_tag_name }}{{ attrs(album_detail_picture_list_item_attributes|default).addClass('gc-album-detail-picture-list-item') }}>
75-
{% include "@Contao/component/_figure.html.twig" with {
76-
figure: figure(picture.figureUuid, picture.figureSize, picture.figureOptions)
77-
} %}
78-
</{{ album_detail_picture_list_item_tag_name }}>
79-
{% endfor %}
80-
</{{ album_detail_picture_list_tag_name }}>
81-
{% endif %}
82-
{% endblock %}
83-
65+
{% if images|default %}
66+
{% block album_detail_picture_list %}
67+
{# !!! The gallery is rendered here!!! #}
68+
{% with {items: images } %}{{ block('list_component') }}{% endwith %}
69+
{% endblock %}
70+
{% endif %}
8471
{% block album_detail_article_post %}
8572
{% if insertArticlePost %}
8673
<div{{ attrs(album_detail_article_post_attributes|default).addClass('gc-album-detail-article-post') }}>
@@ -90,4 +77,8 @@
9077
{% endblock %}
9178
</div>
9279
</div>
80+
81+
{% block album_detail_script %}
82+
{# Add your javascript here. #}
83+
{% endblock %}
9384
{% endblock %}

‎contao/templates/component/_album_list_view.html.twig‎ renamed to ‎contao/templates/_new/component/_album_list_view.html.twig‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{% block album_list_view %}
55
<!-- indexer::stop -->
6-
<div{{ attrs(album_list_view_attributes|default).addClass('gc-album-list-view') }}>
6+
<div{{ attrs(album_list_view_attributes|default).addClass('gc-album-list-view') }}>
77
{% block album_list_pagination %}
88
{{ listPagination|raw }}
99
{% endblock %}
@@ -34,5 +34,8 @@
3434
</{{ album_list_tag }}>
3535
{% endblock %}
3636
</div>
37+
{% block album_list_script %}
38+
{# Add your javascript here. #}
39+
{% endblock %}
3740
<!-- indexer::continue -->
3841
{% endblock %}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{# content_element/gallery_creator.html.twig #}
2+
3+
{% extends "@Contao/content_element/_base.html.twig" %}
4+
{% use '@Contao_MarkocupicGalleryCreatorBundle/component/_album_list_view.html.twig' %}
5+
{% use '@Contao_MarkocupicGalleryCreatorBundle/component/_album_detail_view.html.twig' %}
6+
{% use "@Contao_MarkocupicGalleryCreatorBundle/component/_album.html.twig" %}
7+
{% use "@Contao/component/_figure.html.twig" %}
8+
9+
{% block content %}
10+
11+
{% if hasBreadcrumb and showAlbumDetail %}
12+
<nav class="gc-breadcrumb-nav">
13+
{{ breadcrumb|raw }}
14+
</nav>
15+
{% endif %}
16+
17+
{% if showAlbumDetail %}
18+
{% block album_detail_view %}
19+
{# Do your template modification (e.g. add css classes, replace tag names, etc.) below here: #}
20+
21+
{{ parent() }}
22+
{% endblock %}
23+
{% endif %}
24+
25+
{% if showAlbumListing %}
26+
{% block album_list_view %}
27+
{# Do your template modification (e.g. add css classes, replace tag names, etc.) below here: #}
28+
29+
{{ parent() }}
30+
{% endblock %}
31+
{% endif %}
32+
33+
{% endblock %}
34+
35+
{% block list_item %}
36+
{% if showAlbumDetail and item.figure.build|default %}
37+
{% with {figure: item.figure.build} %}{{ block('figure_component') }}{% endwith %}
38+
{% endif %}
39+
{% endblock %}
40+
41+
{% block list %}
42+
{% if showAlbumDetail %}
43+
{% set list = list|merge({'list_attributes': attrs(list.list_attributes|default)
44+
.removeClass("content-#{type}")
45+
.addClass('gc-album-detail-picture-list')}) %}
46+
47+
{% set list = list|merge({'item_attributes': attrs(list.item_attributes|default)
48+
.addClass('gc-album-detail-picture-list-item')}) %}
49+
{% endif %}
50+
51+
{{ parent() }}
52+
{% endblock %}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{# content_elemnt/gallery_creator_news.html.twig #}
2+
3+
{% extends '@Contao/block_searchable' %}
4+
{% use '@Contao_MarkocupicGalleryCreatorBundle/component/_album_detail_view.html.twig' %}
5+
{% use "@Contao/component/_figure.html.twig" %}
6+
7+
{% block content %}
8+
9+
{% block album_detail_view %}
10+
{# Do your template modification (e.g. add css classes, replace tag names, etc.) below here: #}
11+
12+
{{ parent() }}
13+
{% endblock %}
14+
15+
{% endblock %}
16+
17+
{% block list_item %}
18+
{% if showAlbumDetail %}
19+
{% with {figure: item.figure} %}{{ block('figure_component') }}{% endwith %}
20+
{% endif %}
21+
{% endblock %}
22+
23+
{% block list %}
24+
{% if showAlbumDetail %}
25+
{% set list = list|merge({'list_attributes': attrs(list.list_attributes|default)
26+
.removeClass("content-#{type}")
27+
.addClass('gc-album-detail-picture-list')}) %}
28+
29+
{% set list = list|merge({'item_attributes': attrs(list.item_attributes|default)
30+
.addClass('gc-album-detail-picture-list-item')}) %}
31+
{% endif %}
32+
33+
{{ parent() }}
34+
{% endblock %}

‎contao/templates/content_element/gallery_creator.html.twig‎

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎contao/templates/content_element/gallery_creator_news.html.twig‎

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎docs/chmod.png‎

-3 Bytes
Loading

0 commit comments

Comments
 (0)