SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/navigation_dropdown.php

  1. <?php
  2. use Sprout\Helpers\Enc;
  3. use Sprout\Helpers\File;
  4. use Sprout\Helpers\NavigationMenu;
  5. ?>
  6.  
  7.  
  8. <div class="mega-menu">
  9. <div class="container">
  10.  
  11. <div class="mega-menu-preview">
  12. <h2 class="mega-menu-preview-title"><?php echo Enc::html($parent_node->getNavigationName()); ?></h2>
  13.  
  14. <?php if (!empty($extra['text'])): ?>
  15. <p><?php echo Enc::html($extra['text']); ?></p>
  16. <?php endif; ?>
  17.  
  18. <?php if (!empty($extra['image']) and File::exists($extra['image'])): ?>
  19. <div class="mega-menu-preview-image" style="background-image: url(<?php echo File::resizeUrl($extra['image'], 'c230x120-cc'); ?>);"></div>
  20. <?php else: ?>
  21. <div class="mega-menu-preview-image"></div>
  22. <?php endif; ?>
  23. </div>
  24.  
  25. <div class="mega-menu-columns -clearfix">
  26. <?php
  27. $column = 0;
  28. foreach ($groups as $name => $items) {
  29. $column++;
  30.  
  31. echo '<div class="mega-menu-column mega-menu-column', $column, ' -clearfix">', PHP_EOL;
  32.  
  33. if (substr($name, 0, 1) === '-') {
  34. echo '<h2 class="mega-menu-column-title blank">&nbsp;</h2>', PHP_EOL;
  35. } else {
  36. echo '<h2 class="mega-menu-column-title">', Enc::html($name), '</h2>', PHP_EOL;
  37. }
  38.  
  39. echo '<ul class="mega-menu-submenu -clearfix mega-menu-depth2">', PHP_EOL;
  40.  
  41. foreach ($items as $node) {
  42. $classes = NavigationMenu::determineClasses($node, 2, null, $selected_node, $selected_ancestors, false);
  43.  
  44. echo '<li class="', Enc::html(implode(' ', $classes)), '">';
  45. echo '<a href="', Enc::html($node->getFriendlyUrl()), '">', Enc::html($node->getNavigationName()), '</a>';
  46. echo '</li>', PHP_EOL;
  47. }
  48.  
  49. echo '</ul>', PHP_EOL;
  50. echo '</div>', PHP_EOL;
  51. }
  52. ?>
  53. </div>
  54.  
  55. </div>
  56. </div>