Recent Topics

New extension have 2 active menu items in the admin panel



  • Hello,

    I have created a new extension that have 2 menu items, but when 2nd menu is selected both items get the 'active' class in the html tags

    This is my admin-menu.php

    <?php
    
    return [
        [
            'key' => 'simple-product-import',
            'name' => 'SimpleProductImport',
            'route' => 'admin.simple-product-import.index',
            'sort' => 99, // to get as the last
            'icon-class' => 'simple-product-import-icon',
        ],
        [
            'key' => 'simple-product-import.index',
            'name' => 'Import',
            'route' => 'admin.simple-product-import.index',
            'sort' => 1,
            'icon-class' => '',
        ],
        [
            'key' => 'simple-product-import.sample',
            'name' => 'Sample files',
            'route' => 'admin.simple-product-import.sample-file',
            'sort' => 2,
            'icon-class' => '',
        ]
    ];
    

    the generated HTML

    <li class="menu-item active">
      <a class="menubar-anchor"  href="https://bagisto.test/admin/simple-product-import">
        <span class="icon-menu icon simple-product-import-icon"></span>
        <span class="menu-label">SimpleProductImport</span>
        <span  class="icon arrow-icon rotate-arrow-icon arrow-icon-left"></span>
      </a>
      <ul class="sub-menubar">
        <li class="sub-menu-item active">
           <a href="https://bagisto.test/admin/simple-product-import">
           <span class="menu-label">Import</span>
           </a>
        </li>
        <li class="sub-menu-item active">
          <a href="https://bagisto.test/admin/simple-product-import/sample-file">
            <span class="menu-label">Sample files</span>
          </a>
        </li>
      </ul>
    </li>
    

    As you can see, two <li> have 'sub-menu active'

    Any hints why ?



  • Hi there,
    Is it posible to share the screen recording for the same , it will help me to reproduce the issue.


Log in to reply