Skip to content

Commit

Permalink
Update href to determine if the type is grouping in TOC [PUB-233]
Browse files Browse the repository at this point in the history
  • Loading branch information
web-dev-trev committed Aug 26, 2024
1 parent 1bb2c81 commit dfa936e
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
$isExpanded = true;
}
$isActive = isset($currentArticle) && $item->id === $currentArticle->id;
if ($item->type === App\Enums\DigitalPublicationArticleType::Grouping) {
$href = route(
'collection.publications.digital-publications.showListing',
[
'id' => $item->digitalPublication->id,
'slug' => $item->digitalPublication->getSlug()
]
) . '#' . Str::kebab($item->title);
} else {
$href = $item->url;
}
@endphp

@if (count($item->children) > 0)
Expand All @@ -24,7 +36,7 @@
</div>
@else
<span class="m-link-list__item o-accordion__panel-content">
<a class="m-link-list__trigger f-secondary {{ $isActive ? 'active' : '' }}" href="{{ $item->url }}"{!! (isset($item->gtmAttributes)) ? ' '.$item->gtmAttributes.'' : '' !!}>
<a class="m-link-list__trigger f-secondary {{ $isActive ? 'active' : '' }}" href="{{ $href }}"{!! (isset($item->gtmAttributes)) ? ' '.$item->gtmAttributes.'' : '' !!}>
<span class="m-link-list__label">{!! $item->title !!}</span>
</a>
</span>
Expand Down

0 comments on commit dfa936e

Please sign in to comment.