I'm creating a plugin that will make use of the backend submenu. I was able to get my Plugin name and icon to appear in the main menu just by updating my main Plugin.php registration file, but I'm not having luck getting the submenu to appear. Here is the code from my registration file:
<?php namespace Cargo\Sitewriter;
use Backend;
use Controller;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public function pluginDetails()
{
return [
'name' => 'Site Writer',
'description' => 'Develop and refine your website content',
'author' => 'CargoPants',
'icon' => 'icon-sitemap'
];
}
public function registerComponents()
{
return [
'Cargo\Sitewriter\Components\Pages' => 'sitewriterPages'
];
}
public function registerNavigation()
{
return [
'siteWriter' => [
'label' => 'Site Writer',
'url' => Backend::url('cargo/sitewriter/pages'),
'icon' => 'icon-sitemap',
'permissions' => ['cargo.sitewriter.*'],
'order' => 500,
'sideMenu' => [
'newPage' => [
'label' => 'New Page',
'icon' => 'icon-copy',
'url' => Backend::url('cargo/sitewriter/pages/'),
'permissions' => ['cargo.sitewriter.create_new_pages'],
],
]
]
];
}
}
In the registerNavigation() method, I'm creating a nested array inside of 'sideMenu'. This is how the docs referenced it. Is there more I am supposed to do to get the default backend sidebar to appear with my 'newPage' icon? The 'siteWriter' icon is appearing as it should in the main menu.
Thanks.
Last updated