October CMS resources and help articles

Simple and to the point. Optimized by the community.

Set order of backend menu items

0
by OFFLINE, last modified on October 1st, 2021

Especially with larger projects, it makes sense to sort the backend menu items.

Blinks4451850 and mjauvin have developed a clear variant to control the order:

Event::listen('backend.menu.extendItems', function ($manager) {
    $items = $manager->listMainMenuItems();
    $data = [
        'October.Backend.Media',
        'October.Backend.Dashboard',
        'October.Cms.cms',
        'RainLab.Builder.Builder',
    ];
    $i = 0;
    foreach ($data as $name) {
        if ($item = array_get($items, strtoupper($name), false)) {
            $item->order = $i;
            $i++;
        }
    }
});

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?