<?php if (!function_exists('renderAccordionMenu')) {
  function renderAccordionMenu($context, $item) {
    $journal3 = $context['journal3'];
    $image_width = $context['image_width'];
    $image_height = $context['image_height'];
    ?>
    <li class="<?php if ($item['isDivider']): ?>is-divider<?php endif; ?> <?php echo str_replace('dropdown', '', $journal3->classes($item['classes'])); ?> <?php if (!empty($item['isOpen']) && $item['items']) {?> <?php } ?>">
      <?php $id = $journal3->uniqueId('collapse-'); ?>
      <?php if ($item['link']['href']): ?>
        <a href="<?php echo $item['link']['href']; ?>" <?php echo $journal3->linkAttrs($item['link']); ?>>
          <?php if (!empty($item['thumb'])): ?>
          <span class="menu-image">
            <img src="<?php echo $item['thumb']; ?>" <?php if (!empty($item['thumb2x'])): ?>srcset="<?php echo $item['thumb']; ?> 1x, <?php echo $item['thumb2x']; ?> 2x" <?php endif; ?> alt="<?php echo $item['title']; ?>" width="<?php echo $image_width; ?>" height="<?php echo $image_height; ?>"/>
          </span>
          <?php endif; ?>
          <?php echo $journal3->countBadge($item['title'], $item['link']['total'], $item['link']['classes']); ?>
          <?php if ($item['items']): ?>
            <?php if (!empty($item['isOpen'])): ?>
              <span class="open-menu" data-toggle="collapse" data-target="#<?php echo $id; ?>" aria-expanded="true" role="heading"><em class="fa fa-plus"></em></span>
            <?php else: ?>
              <span class="open-menu collapsed" data-toggle="collapse" data-target="#<?php echo $id; ?>" role="heading"><em class="fa fa-plus"></em></span>
            <?php endif; ?>
          <?php endif; ?>
        </a>
      <?php else: ?>
        <a>
          <?php if (!empty($item['thumb'])): ?>
          <span class="menu-image">
            <img src="<?php echo $item['thumb']; ?>" <?php if (!empty($item['thumb2x'])): ?>srcset="<?php echo $item['thumb']; ?> 1x, <?php echo $item['thumb2x']; ?> 2x" <?php endif; ?> alt="<?php echo $item['title']; ?>" width="<?php echo $image_width; ?>" height="<?php echo $image_height; ?>"/>
          </span>
          <?php endif; ?>
          <?php echo $journal3->countBadge($item['title'], $item['link']['total'], $item['link']['classes']); ?>
          <?php if ($item['items']): ?>
            <?php if (!empty($item['isOpen'])): ?>
              <span class="open-menu" data-toggle="collapse" data-target="#<?php echo $id; ?>" aria-expanded="true" role="heading"><em class="fa fa-plus"></em></span>
            <?php else: ?>
              <span class="open-menu collapsed" data-toggle="collapse" data-target="#<?php echo $id; ?>" role="heading"><em class="fa fa-plus"></em></span>
            <?php endif; ?>
          <?php endif; ?>
        </a>
      <?php endif; ?>
      <?php if ($item['items']): ?>
        <div class="collapse <?php if (!empty($item['isOpen'])): ?>in<?php endif; ?>" id="<?php echo $id; ?>">
          <ul class="j-menu">
            <?php foreach ($item['items'] as $subitem): ?>
              <?php renderAccordionMenu($context, $subitem); ?>
            <?php endforeach; ?>
          </ul>
        </div>
      <?php endif; ?>
    </li>
    <?php
  }
} ?>
<div class="<?php echo $journal3->classes($classes); ?>">
  <button aria-label="Edit" class="admin-edit" type="button" data-edit="<?php echo $edit; ?>"><em class="fa fa-pencil" data-placement="auto" data-toggle="tooltip-hover" data-tooltip-class="admin-edit-tooltip" title="Edit <?php echo $name; ?>"></em></button>
  <?php if ($title): ?>
    <h3 class="title module-title"><?php echo $title; ?></h3>
  <?php endif; ?>
  <ul class="j-menu">
    <?php foreach ($items as $item): ?>
      <?php renderAccordionMenu(get_defined_vars(), $item); ?>
    <?php endforeach; ?>
  </ul>
</div>
