-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OEL-1160: Header refactor. #71
Conversation
123e223
to
e5ec342
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modules/oe_whitelabel_helper/src/TwigExtension/TwigExtension.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add the new tag for the new logo location in OEBT
templates/overrides/navigation/block--system-branding-block.html.twig
Outdated
Show resolved
Hide resolved
templates/overrides/navigation/block--system-branding-block.html.twig
Outdated
Show resolved
Hide resolved
{% set name_classes = [ | ||
'text-decoration-none', | ||
'align-bottom', | ||
light ? 'text-dark': 'text-white', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7748bf0
to
129eec2
Compare
*/ | ||
function oe_whitelabel_preprocess_page(&$variables) { | ||
if ($variables['bcl_component_library'] === 'ec') { | ||
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Commission'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Commission'); | |
$variables['logo_aria_label'] = t('Home - European Commission'); |
oe_whitelabel.theme
Outdated
$site_logo_href = 'https://ec.europa.eu/info'; | ||
} | ||
elseif ($variables['bcl_component_library'] === 'eu') { | ||
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Union'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$variables['logo_aria_label'] = t('Home') . ' - ' . t('European Union'); | |
$variables['logo_aria_label'] = t('Home - European Union'); |
{% set img_classes = ['d-none','d-lg-inline-block', 'text-decoration-none', 'site-logo'] %} | ||
<a {{ create_attribute().addClass(img_classes).setAttribute('rel', 'Home') }} href="{{ path('<front>') }}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% set img_classes = ['d-none','d-lg-inline-block', 'text-decoration-none', 'site-logo'] %} | |
<a {{ create_attribute().addClass(img_classes).setAttribute('rel', 'Home') }} href="{{ path('<front>') }}"> | |
<a class="d-none d-lg ...." href="{{ path('<front>') }}"> |
Rel attribute I didn't find a value for home https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
#} | ||
{% set attributes = attributes.addClass('nav') %} | ||
{% if content %} | ||
<ul{{ attributes }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, region content inside a ul tag? This is weird.
{% set attributes = create_attribute().addClass(['bcl-header', 'bcl-header--' ~ bcl_component_library]) %} | ||
<header {{ attributes }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just output in the header tag.
{% else %} | ||
<div class="container mt-5"> | ||
{% endif %} | ||
<div class="container {{ page.header ? 'mt-2': 'mt-5' }} "> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class="container {{ page.header ? 'mt-2': 'mt-5' }} "> | |
<div class="container {{ page.header ? 'mt-2': 'mt-5' }}"> |
$builder = \Drupal::entityTypeManager()->getViewBuilder('block'); | ||
$build = $builder->view($entity, 'block'); | ||
$render = $this->container->get('renderer')->renderRoot($build); | ||
$crawler = new Crawler($render->__toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$crawler = new Crawler($render->__toString()); | |
$crawler = new Crawler((string) $render); |
{# | ||
/** | ||
* @file | ||
* Default theme implementation to display a region. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this. Write which template we are overriding too.
{% if light is not empty %} | ||
{% set project_classes = project_classes ~ ' light' %} | ||
{% endif %} | ||
<div {{ create_attribute().addClass(project_classes) }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div {{ create_attribute().addClass(project_classes) }}> | |
<div class="bcl-header__project{{ light is not empty ? ' light' }}"> |
</a> | ||
{% endif %} | ||
{% if site_name is not empty %} | ||
{% set name_classes = [ | ||
'text-decoration-none', | ||
'align-bottom', | ||
'bcl-header__site-name', | ||
'mw-100', | ||
] %} | ||
{% set _site_name %} | ||
<a {{ create_attribute().addClass(name_classes).setAttribute('rel', 'Home') }} | ||
href="{{ path('<front>') }}"> | ||
{{ site_name }} | ||
</a> | ||
{% endset %} | ||
{% set _site_name_classes = ['bcl-header__site-name', 'site-name'] %} | ||
{% if bcl_component_library == 'neutral' %} | ||
{% set _site_name_classes = _site_name_classes|merge(['h5', 'd-inline-block', 'd-lg-none']) %} | ||
{% endif %} | ||
<div {{ create_attribute().addClass(_site_name_classes) }}> | ||
{{ _site_name }} | ||
</div> | ||
{% endif %} | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't abuse attributes, if you can just output in html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's rebase and merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add the diff to 1.x in composer
https://citnet.tech.ec.europa.eu/CITnet/jira/browse/OEL-1160
oe_bootstrap_theme changes are requested to manage BCL EU/EC logos