Skip to content

Commit

Permalink
Add logic to enable opening hours sidebar
Browse files Browse the repository at this point in the history
By default, the opening hours sidebar should not be enabled. You need to remove the default `Opening Hours Link` text to enable it.
  • Loading branch information
kasperbirch1 committed Sep 17, 2024
1 parent 84390ae commit dcafd75
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ public function buildForm(array $form, FormStateInterface $form_state): array {

$form['opening_hours_url'] = [
'#type' => 'linkit',
'#title' => $this->t('Opening hours link', [], ['context' => 'Library Agency Configuration']),
'#title' => $this->t('Opening Hours Link (remove link to enable sidebar)', [], ['context' => 'Library Agency Configuration']),
'#description' => $this->t('The link with information about opening hours. <br />
If no link is added, the opening hours sidebar modal is enabled. <br />
You can add a relative url (e.g. /takster). <br />
You can search for an internal url. <br />
You can add an external url (starting with "http://" or "https://").', [], ['context' => 'Library Agency Configuration']),
Expand Down
26 changes: 26 additions & 0 deletions web/themes/custom/novel/templates/layout/header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,19 @@
</div>
{{ patron_menu }}
<div class="header__button-responsive-switch">
{% if opening_hours_url %}
<a href="{{ opening_hours_url }}"
class="header__button header__button--left-border">
<img class="header__button-icon" loading="lazy" width="24"
height="24"
src="/themes/custom/novel/assets/dpl-design-system/icons/basic/icon-watch-static.svg"
alt="clock icon"/>
<span
class="header__button-text">{{ "Opening hours"|t }}</span>
</a>
{% else %}
{{ opening_hours_sidebar_small }}
{% endif %}
<a href="{{ url('dpl_favorites_list.list') }}" class="header__button header__button--left-border">
<img class="header__button-icon" width="24" height="24" src="/themes/custom/novel/assets/dpl-design-system/icons/basic/icon-heart.svg" alt="{{ 'List of bookmarks'|t({}, {'context': 'Header'}) }}"/>
<span class="header__button-text">{{ "Liked"|t({}, {'context': 'Global'}) }}</span>
Expand All @@ -36,7 +48,21 @@
</nav>
{{ search_header }}
</div>
{% if opening_hours_url %}
<div class="header__clock">
<div class="pagefold-parent--medium">
<div class="pagefold-triangle--medium"></div>
</div>
<a href="{{ opening_hours_url }}" class="header__clock-items">
<img loading="lazy" width="58" height="58"
src="/themes/custom/novel/assets/dpl-design-system/icons/basic/icon-watch-static.svg"
class="mb-8" alt=""/>
<span class="text-small-caption link-tag">{{ "Opening hours"|t }}</span>
</a>
</div>
{% else %}
{{ opening_hours_sidebar_large }}
{% endif %}
</header>
<div class="header-sidebar-nav" data-open="closed">
<div class="header-sidebar-nav__background-wrapper">
Expand Down

0 comments on commit dcafd75

Please sign in to comment.