Using new sidebar event listener for Workshop module

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