K4 Get menu from plugin

I’m trying to implement a custom menu panel | Kirby CMS but I don’t want to make the defininition on the config.php file but inside a plugin. Is this possible?

It’s a config option, not an extension, so no, options within a plugin are prefixed with the plugin name, so the call to

	$menu = $kirby->option('panel.menu', [

would fail.

Why don’t you want to define it in the config? If you want to keep the config file clean, require a separate file, and define the menu there…

'panel' => [
    'menu' => require 'menu.php',



return [
	'post' => [
		'icon'    => 'add',
		'label'   => 'New note',
		'link' => 'dialogs/pages/create?parent=pages/notes&template=note',

Hi! Thanks for your answer! Yes I used the separate file like I saw on “K4 release show”.

But I think for plugins it will be really helpful that items can be added to the sidebar automatically when installing the plugin. I just remember that Retour plugin can do that on K3.x version.
I just checked the repo and from the screenshot it seems feasible. I will need to dive deeper on Retour code to see how to do this.

I used this as starting point retour-for-kirby/src/extensions/areas.php at 3bd40a5243fac3b85abbe1b09e3a5cbcaf3c5558 · distantnative/retour-for-kirby · GitHub
And it seems to work :slight_smile:

Yes, right, but that’s another story. That example is a custom area, see

With the menu option, you define which menu entries to show/hide.

1 Like