Closed Defcon0 closed 2 years ago
Hello,
in the default template mmenu_default a check for a non-existing index is missing. Correct would be:
mmenu_default
<?php $GLOBALS['TL_CSS']['contao_dk_mmenu'] = 'bundles/contaommenu/mmenu/mmenu.css|static'; if ($this->options['polyfill'] ?? false) { $GLOBALS['TL_JAVASCRIPT']['contao_dk_mmenu.polyfill'] = 'bundles/contaommenu/mmenu/mmenu.polyfills.js|static'; } $GLOBALS['TL_JAVASCRIPT']['contao_dk_mmenu'] = 'bundles/contaommenu/mmenu/mmenu.js|static'; if ($this->options['drag']['menu']['open'] ?? false) { $GLOBALS['TL_JAVASCRIPT']['contao_dk_mmenu.hammerjs'] = 'bundles/contaommenu/hammerjs/hammer.min.js|static'; } ?> <script> document.addEventListener( "DOMContentLoaded", function () { const menu = document.querySelector('#<?= $this->elementId ?>'); if (null !== menu && 0 === menu.querySelectorAll('li.active').length) { const trails = menu.querySelectorAll('li.trail'); if (0 < trails.length) { trails.item(trails.length - 1).classList.add('active'); } } new Mmenu('#<?= $this->elementId ?>', <?= json_encode($this->options) ?>, <?= json_encode($this->configuration) ?>); } ); </script>
Could ypu please add the fix to the repo? Thanks!
Could ypu please add the fix to the repo?
Just provide a PR? ;)
Done ;-) Thought it would be too less for a PR (only 2 lines) ;-)
https://github.com/dklemmt/contao_dk_mmenu/pull/65
@fritzmg: Should be solved, shouldn't it?
Hello,
in the default template
mmenu_default
a check for a non-existing index is missing. Correct would be:Could ypu please add the fix to the repo? Thanks!