Boilerplate to use a Directus Instance to Build a Custom Website, Content will be Manage by Directus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

3 years ago
  1. @foreach($menuItems['data'] as $item)
  2. @php
  3. // class if url is same as page
  4. $current = NULL;
  5. // attribute target
  6. $target = NULL;
  7. // if page is not null
  8. if ($item['page']) {
  9. $title = $item['page']['title'];
  10. $url = '/'.$item['page']['slug'];
  11. // if page is current page
  12. $current = isCurrentPage($item['page']['slug'], ' current');
  13. // if title is set overwrite
  14. if ($item['title']) {
  15. $title = $item['title'];
  16. }
  17. // if page empty and only title and url is set
  18. } elseif ($item['title'] && $item['url']) {
  19. $title = $item['title'];
  20. $url = $item['url'];
  21. // if target set
  22. if (isset($item['target'])) {
  23. $target = 'target='.$item['target'];
  24. if ($item['target'] === '_blank') {
  25. $target .= ' rel=noreferrer';
  26. }
  27. }
  28. } else {
  29. continue;
  30. }
  31. @endphp
  32. <a class="tabs__item{{ $current }}" {{ $target }} href="{{ $url }}">
  33. {{ $title }}
  34. </a>
  35. @endforeach