Shortcuts
Introduction
Shortcuts are notification type indicators that also support dropdown menus.
Defining Shortcuts
Shortcuts are defined on your module
similar to sections.
protected $shortcuts = [
'settings' => [
[
'icon' => 'fa fa-cogs',
'href' => '/admin/settings',
]
]
];
You can also set the dynamically using a handler.
<?php namespace Anomaly\SettingsModule;
use Anomaly\Streams\Platform\Addon\Module\ModuleCollection;
use Anomaly\Streams\Platform\Ui\ControlPanel\ControlPanelBuilder;
class SettingsModuleShortcuts
{
public function handle(ControlPanelBuilder $builder, ModuleCollection $modules)
{
if (!$module = $modules->active()) {
return;
}
if (!$module->hasAnyConfig(['settings', 'settings/settings'])) {
return;
}
$builder->addShortcut(
'settings',
[
'icon' => 'cogs',
'href' => 'admin/settings/modules/' . $module->getNamespace(),
]
);
}
}