-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock--bundle--full-block-with-image-and-text.html.twig
executable file
·49 lines (43 loc) · 1.67 KB
/
block--bundle--full-block-with-image-and-text.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{% block content %}
{{ content|without('field_color','field_body','field_image','field_fwti_image_ratio') }}
{% set color = content.field_color['#items'].getValue() %}
{% set fileuri = content.field_image['#items'].entity.getFileUri() %}
{% if content.field_fwti_image_ratio['#items'].getValue() %}
{% set ratio_field = content.field_fwti_image_ratio['#items'].getValue() %}
{% set ratio = ratio_field.0.value %}
{% endif %}
{% if ratio is not empty %}
{% set image_object = image_style(content.field_image['#items'].entity.fid.value, [ratio]) %}
{% set image_path = image_object[ratio] %}
{% endif %}
{% set blockclass = 'block' %}
<div {{ attributes.addClass(blockclass) }} >
{{ title_prefix }}
{% if label %}
<h2{{ title_attributes }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
{% if color != '' %}
<div class="s3-{{ color.0.value }} block s3-m-8 full-with-image">
{% else %}
<div class="block s3-m-8 full-with-image">
{% endif %}
<div class="row">
{% if fileuri %}
<div class="col-xs-12 col-sm-8">
{% if ratio is not empty %}
<img class="img-responsive full_width" alt="" src="{{ image_path }}">
{% else %}
<img class="img-responsive" src="{{ file_url(content.field_image['#items'].entity.getFileUri()) }}">
{% endif %}
</div>
{% endif %}
{% if content.field_body %}
<div class="col-xs-12 col-sm-4 ftwi">
{{ content.field_body }}
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}