0

What steps should I follow to add a new option to the left menu of the SULU administration panel? Following the documentation I did not succeed.

1 Answers1

1

To extend the admin menu you need to create a new "Admin" class in your src/Admin folder and extend from the Sulu Admin class and then:

<?php

namespace App\Admin;


use Sulu\Bundle\AdminBundle\Admin\Admin;
use Sulu\Bundle\AdminBundle\Admin\Navigation\NavigationItemCollection;
use Sulu\Bundle\AdminBundle\Admin\View\ViewCollection;


class EventAdmin extends Admin
{
    const EVENT_LIST_VIEW = 'app.events_list';

    public function configureNavigationItems(NavigationItemCollection $navigationItemCollection): void
    {
        $eventNavigationItem = new NavigationItem('app.events');
        $eventNavigationItem->setView(static::EVENT_LIST_VIEW);
        $eventNavigationItem->setIcon('su-calendar');
        $eventNavigationItem->setPosition(30);

        $navigationItemCollection->add($eventNavigationItem);
    }
}

See more in the documentation here https://docs.sulu.io/en/2.2/book/extend-admin.html and I really can recommend to do https://github.com/sulu/sulu-workshop first to get into sulu.

If you get any error you should show the error instead of saying you tried and it did not work. Look for error in your browser dev tools console, network tab, symfony log or webservers log.

Alexander Schranz
  • 2,154
  • 2
  • 25
  • 42