Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a9f320c3 authored by escuriola's avatar escuriola
Browse files

OEL-1147: Corporate and neutral footer refactor.

parent 0866771b
No related branches found
No related tags found
1 merge request!81OEL-1147 - Footer
{# {% extends "oe-corporate-blocks-neutral-footer.html.twig" %}
/** {% block content %}
* @file {% set _top_sections = {
* Default theme implementation for rendering corporate blocks footer. 'extra_classes': 'pt-4 pt-lg-5',
* 'cols': [
* Available variables: {
* - site_owner: Site's owner. 'classes': 'col-12 col-lg-4',
* - site_specific_footer: Array (optional) with structure of the site specific footer compatible with the ECL ec-components-footer component. 'items': [
* - site_identity: Site identity for custom footer. {
* - social_links: Social media links for custom footer. 'type': 'content',
* - other_links: Other links for custom footer. 'content': footer_top_left_content,
* - corporate_footer: Array with structure of corporate footer compatible with the ECL ec-components-footer component. },
* - corporate_site_link: Corporate site link. ],
* - class_navigation: Provides the user with navigation through class names. },
* - service_navigation: Contains services links - consistent throughout the family sites. {
* - legal_navigation: Contains legal information links - consistent throughout the family sites. 'classes': 'col-12 col-lg-4 pb-4 pb-lg-0',
* 'items': _section_2,
* @ingroup themeable },
*/ {
#} 'classes': 'col-12 col-lg-4',
'items': _section_3,
{% set _section_2 = [] %} }
{% set _section_3 = [] %} ],
} %}
{# First we parse the other_links, we make a simple grid. #}
{% for section in site_specific_footer.other_links %}
{% if loop.index is odd %}
{% set _section_2 = _section_2|merge([{
'title': section.label,
'links': bcl_footer_links(section.links),
}]) %}
{% else %}
{% set _section_3 = _section_3|merge([{
'title': section.label,
'links': bcl_footer_links(section.links),
}]) %}
{% endif %}
{% endfor %}
{# When follow section is present. #}
{% if site_specific_footer.social_links is not empty %}
{# If section numbers are odd, then we flip the last row so to have the follow as first. #}
{% if _section_2|length > _section_3|length %}
{% set _last_in_section_2 = _section_2|last %}
{# Compensate for bug in twig where _section_2[1:] returns empty if _section_2|length is 1. #}
{% if _last_in_section_2 is empty %}
{% set _last_in_section_2 = _section_2[0] %}
{% set _section_2 = [] %}
{% endif %}
{% set _section_2 = _section_2[:_section_2|length - 1] %}
{% set _section_3 = _section_3|merge([_last_in_section_2]) %}
{% endif %}
{# Follow section must always be the last on the left. #}
{% set _section_2 = _section_2|merge([{
'title': 'Follow us on social media'|t,
'links': bcl_footer_links(site_specific_footer.social_links),
}]) %}
{% endif %}
{% set _top_sections = [ {% set site_identity_content %}
{ <p class="fw-bold pb-2 mb-2">{{ 'European Commission'|t }}</p>
'section_id': 'footer_top_left', {% endset %}
'title': {
'link': {
'label': site_specific_footer.site_identity,
'path': url('<front>')|render
}
},
'description': site_owner ? 'This site is managed by the @name'|t({'@name': site_owner}),
},
{
'section_id': 'footer_top_middle',
'sections': _section_2
},
{
'section_id': 'footer_top_right',
'sections': _section_3
}
] %}
{% set _bottom_sections = [ {% set _bottom_sections = {
{ 'extra_classes': 'pb-4 pb-lg-5 bcl-footer__bordered-row row mt-4',
'section_id': 'ec_footer_bottom_left', 'cols': [
'title': { {
'link': { 'classes': 'col-12 col-lg-4 pb-lg-4',
'label': site_specific_footer.site_identity, 'items': [
'path': url('<front>')|render, {
'type': 'content',
'content': site_identity_content,
},
],
},
{
'classes': 'col-12 col-lg-4',
'items': [
{
'type': 'links',
'links': bcl_footer_links(corporate_footer.service_navigation),
}
],
},
{
'classes': 'col-12 col-lg-4',
'items': [
{
'type': 'links',
'links': bcl_footer_links(corporate_footer.legal_navigation),
}
],
} }
} ],
}, } %}
{
'section_id': 'ec_footer_bottom_middle',
'links': bcl_footer_links(corporate_footer.service_navigation),
},
{
'section_id': 'ec_footer_bottom_right',
'links': bcl_footer_links(corporate_footer.legal_navigation)
}
] %}
{% set _middle_sections = [ {% include '@oe-bcl/bcl-footer/bcl-footer.html.twig' with {
{ 'variant': 'ec',
'section_id': 'ec_footer_middle_row', 'rows': [_top_sections, _bottom_sections],
'links': bcl_footer_links(corporate_footer.class_navigation), 'attributes': attributes,
} } only %}
] %} {% endblock %}
<footer class="bcl-footer bcl-footer--ec mt-4">
<div class="container">
{{ pattern('footer', {
'variant': 'ec',
'top_sections': _top_sections,
'middle_sections': _middle_sections,
'bottom_sections': _bottom_sections,
}) }}
</div>
</footer>
{# {% extends "oe-corporate-blocks-neutral-footer.html.twig" %}
/** {% block content %}
* @file {% set _top_sections = {
* Default theme implementation for rendering corporate blocks footer. 'extra_classes': 'pt-4 pt-lg-5',
* 'cols': [
* Available variables: {
* - corporate_footer: Array with structure compatible to ECL ec-components-footer component. 'classes': 'col-12 col-lg-4',
* - contact: EU contact data for corporate footer. 'items': [
* - social_media_title: Title for social media links column. {
* - social_media: Social media links for corporate footer. 'type': 'content',
* - institution_links_title: Title for institution links column. 'content': footer_top_left_content,
* - institution_links: EU institutions links for corporate footer. },
* - legal_links_title: Title for legal links column. ],
* - legal_links: Legal links for corporate footer. },
* {
* @ingroup themeable 'classes': 'col-12 col-lg-4 pb-4 pb-lg-0',
*/ 'items': _section_2,
#} },
{
{% set _section_2 = [] %} 'classes': 'col-12 col-lg-4',
{% set _section_3 = [] %} 'items': _section_3,
}
{# First we parse the other_links, we make a simple grid. #} ],
{% for section in site_specific_footer.other_links %} } %}
{% if loop.index is odd %}
{% set _section_2 = _section_2|merge([{
'title': section.label,
'links': bcl_footer_links(section.links),
}]) %}
{% else %}
{% set _section_3 = _section_3|merge([{
'title': section.label,
'links': bcl_footer_links(section.links),
}]) %}
{% endif %}
{% endfor %}
{# When follow section is present. #}
{% if site_specific_footer.social_links is not empty %}
{# If section numbers are odd, then we flip the last row so to have the follow as first. #}
{% if _section_2|length > _section_3|length %}
{% set _last_in_section_2 = _section_2|last %}
{# Compensate for bug in twig where _section_2[1:] returns empty if _section_2|length is 1. #}
{% if _last_in_section_2 is empty %}
{% set _last_in_section_2 = _section_2[0] %}
{% set _section_2 = [] %}
{% endif %}
{% set _section_2 = _section_2[:_section_2|length - 1] %}
{% set _section_3 = _section_3|merge([_last_in_section_2]) %}
{% endif %}
{# Follow section must always be the last on the left. #}
{% set _section_2 = _section_2|merge([{
'title': 'Follow us on social media'|t,
'links': bcl_footer_links(site_specific_footer.social_links),
}]) %}
{% endif %}
{% set _top_sections = [ {% set _bottom_sections = {
{ 'extra_classes': 'pb-4 pb-lg-5 mt-4 mt-lg-5 bcl-footer__bordered-row row',
'section_id': 'footer_top_left', 'cols': [
'title': { {
'link': { 'classes': 'col-12 col-lg-4 pb-4',
'label': site_specific_footer.site_identity, 'items': [
'path': url('<front>')|render {
'type': 'content',
'content': bcl_block('whitelabel_eu_logo_block'),
},
],
},
{
'classes': 'col-12 col-lg-4',
'items': [
{
'type': 'content',
'content': bcl_title(corporate_footer.contact_title, 'fw-bold border-bottom pb-2 mb-2'),
},
{
'type': 'links',
'links': bcl_footer_links(corporate_footer.contact),
},
{
'type': 'content',
'content': bcl_title(corporate_footer.social_media_title, 'fw-bold border-bottom pb-2 pt-3 mb-2'),
},
{
'type': 'links',
'links': bcl_footer_links(corporate_footer.social_media),
},
{
'type': 'content',
'content': bcl_title(corporate_footer.legal_links_title, 'fw-bold border-bottom pb-2 pt-3 mb-2'),
},
{
'type': 'links',
'links': bcl_footer_links(corporate_footer.legal_links),
},
],
},
{
'classes': 'col-12 col-lg-4',
'items': [
{
'type': 'content',
'content': bcl_title(corporate_footer.institution_links_title, 'fw-bold border-bottom pb-2 mb-2'),
},
{
'type': 'links',
'links': bcl_footer_links(corporate_footer.institution_links),
},
],
} }
}, ],
'description': site_owner ? 'This site is managed by the @name'|t({'@name': site_owner}), } %}
},
{
'section_id': 'footer_top_middle',
'sections': _section_2
},
{
'section_id': 'footer_top_right',
'sections': _section_3
}
] %}
{% set _bottom_sections = [ {% include '@oe-bcl/bcl-footer/bcl-footer.html.twig' with {
{ 'variant': 'eu',
'section_id': 'eu_footer_left' 'rows': [_top_sections, _bottom_sections],
}, 'attributes': attributes,
{ } only %}
'section_id': 'eu_footer_middle', {% endblock %}
'contact_eu_title': corporate_footer.contact_title,
'contact_eu_links': bcl_footer_links(corporate_footer.contact),
'social_media_title': corporate_footer.social_media_title,
'social_media_links': bcl_footer_links(corporate_footer.social_media),
'legal_title': corporate_footer.legal_links_title,
'legal_links': bcl_footer_links(corporate_footer.legal_links)
},
{
'section_id': 'eu_footer_right',
'eu_institutions_title': corporate_footer.institution_links_title,
'eu_institutions_links': bcl_footer_links(corporate_footer.institution_links)
}
] %}
<footer class="bcl-footer bcl-footer--eu mt-4">
<div class="container">
{{ pattern('footer', {
'variant': 'eu',
'top_sections': _top_sections,
'bottom_sections': _bottom_sections,
}) }}
</div>
</footer>
{#
/**
* @file
* Neutral footer.
*/
#}
{% set _section_2 = [] %}
{% set _section_3 = [] %}
{# First we parse the other_links, we make a simple grid. #}
{% for section in site_specific_footer.other_links %}
{% if loop.index is even %}
{% set _section_2 = _section_2|merge([
{
'type': 'content',
'content': bcl_title(section.label,'fw-bold border-bottom pb-2 mb-2 mt-3'),
},
{
'type': 'links',
'links': bcl_footer_links(section.links),
}
]) %}
{% else %}
{% set _section_3 = _section_3|merge([
{
'type': 'content',
'content': bcl_title(section.label,'fw-bold border-bottom pb-2 mb-2 mt-3'),
},
{
'type': 'links',
'links': bcl_footer_links(section.links),
}
]) %}
{% endif %}
{% endfor %}
{# When follow section is present. #}
{% if site_specific_footer.social_links is not empty %}
{# If section numbers are odd, then we flip the last row so to have the follow as first. #}
{% if _section_2|length > _section_3|length %}
{% set _last_in_section_2 = _section_2|last %}
{# Compensate for bug in twig where _section_2[1:] returns empty if _section_2|length is 1. #}
{% if _last_in_section_2 is empty %}
{% set _last_in_section_2 = _section_2[0] %}
{% set _section_2 = [] %}
{% endif %}
{% set _section_2 = _section_2[:_section_2|length - 1] %}
{% set _section_3 = _section_3|merge([_last_in_section_2]) %}
{% endif %}
{# Follow section must always be the last on the left. #}
{% set _section_2 = _section_2|merge([
{
'type': 'content',
'content': bcl_title('Follow us on social media', 'fw-bold border-bottom pb-2 mb-2 mt-3'),
},
{
'type': 'links',
'links': bcl_footer_links(site_specific_footer.social_links),
}]) %}
{% endif %}
{% set footer_top_left_content %}
<div class="col-12 col-lg-4">
<p class="fw-bold mb-2">{{ site_specific_footer.site_identity }}</p>
<p> {{ site_owner ? 'This site is managed by the @name'|t({'@name': site_owner}) }} </p>
</div>
{% endset %}
{% set attributes = create_attribute().addClass(['pb-4', 'mt-4']) %}
{% block content %}
{% set _top_sections = {
'extra_classes': 'pt-4 pt-lg-5',
'cols': [
{
'classes': 'col-12 col-lg-4',
'items': [
{
'type': 'content',
'content': footer_top_left_content,
},
],
},
{
'classes': 'col-12 col-lg-4 pb-4 pb-lg-0',
'items': _section_2,
},
{
'classes': 'col-12 col-lg-4',
'items': _section_3,
}
],
} %}
{% include '@oe-bcl/bcl-footer/bcl-footer.html.twig' with {
'variant': 'neutral',
'rows': [_top_sections],
'attributes': attributes,
} only %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment