Using new sidebar event listener for Workshop module

parent 1b71f1df
<?php
namespace Modules\Workshop\Sidebar;
namespace Modules\Workshop\Events\Handlers;
use Maatwebsite\Sidebar\Group;
use Maatwebsite\Sidebar\Item;
use Maatwebsite\Sidebar\Menu;
use Modules\User\Contracts\Authentication;
use Modules\Core\Sidebar\AbstractAdminSidebar;
class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender
class RegisterWorkshopSidebar extends AbstractAdminSidebar
{
/**
* @var Authentication
*/
protected $auth;
/**
* @param Authentication $auth
*
* @internal param Guard $guard
*/
public function __construct(Authentication $auth)
{
$this->auth = $auth;
}
/**
* Method used to define your sidebar menu groups and items
* @param Menu $menu
*
* @return Menu
*/
public function extendWith(Menu $menu)
......
......@@ -3,12 +3,15 @@
namespace Modules\Workshop\Providers;
use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Services\Composer;
use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Workshop\Console\EntityScaffoldCommand;
use Modules\Workshop\Console\ModuleScaffoldCommand;
use Modules\Workshop\Console\ThemeScaffoldCommand;
use Modules\Workshop\Console\UpdateModuleCommand;
use Modules\Workshop\Events\Handlers\RegisterWorkshopSidebar;
use Modules\Workshop\Manager\StylistThemeManager;
use Modules\Workshop\Manager\ThemeManager;
use Modules\Workshop\Scaffold\Module\Generators\EntityGenerator;
......@@ -20,7 +23,7 @@ use Modules\Workshop\Scaffold\Theme\ThemeScaffold;
class WorkshopServiceProvider extends ServiceProvider
{
use CanPublishConfiguration;
use CanPublishConfiguration, CanGetSidebarClassForModule;
/**
* Indicates if loading of the provider is deferred.
*
......@@ -37,6 +40,11 @@ class WorkshopServiceProvider extends ServiceProvider
{
$this->registerCommands();
$this->bindThemeManager();
$this->app['events']->listen(
BuildingSidebar::class,
$this->getSidebarClassForModule('workshop', RegisterWorkshopSidebar::class)
);
}
public function boot()
......
......@@ -9,6 +9,7 @@ versions:
- Register module migrations by default to ease testing in service provider
- SidebarExtender class has been removed in favor of new Sidebar event handlers
- Register the sidebar event handler in service provider
- Sidebar is now loaded via the <code>BuildingSidebar</code> hook
removed:
- Removing ckeditor from the default scaffolded views, now included via <code>EditorIsRendering</code> hook
"2.4.0":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment