diff --git a/Sidebar/SidebarExtender.php b/Events/Handlers/RegisterContactSidebar.php similarity index 60% rename from Sidebar/SidebarExtender.php rename to Events/Handlers/RegisterContactSidebar.php index d1926a2..7e106c0 100644 --- a/Sidebar/SidebarExtender.php +++ b/Events/Handlers/RegisterContactSidebar.php @@ -1,32 +1,17 @@ auth = $auth; - } - - /** + * Method used to define your sidebar menu groups and items * @param Menu $menu - * * @return Menu */ public function extendWith(Menu $menu) @@ -34,7 +19,7 @@ public function extendWith(Menu $menu) $menu->group(trans('core::sidebar.content'), function (Group $group) { $group->item('Contact requests', function (Item $item) { $item->icon('fa fa-envelope-o'); - $item->weight(0); + $item->weight(config('asgard.contact.config.sidebar-position', 15)); $item->route('admin.contact.contactrequest.index'); $item->authorize( $this->auth->hasAccess('contact.contactrequests.index') diff --git a/Providers/ContactServiceProvider.php b/Providers/ContactServiceProvider.php index 8e889a3..30273f7 100644 --- a/Providers/ContactServiceProvider.php +++ b/Providers/ContactServiceProvider.php @@ -5,14 +5,17 @@ use Illuminate\Database\Eloquent\Factory; use Illuminate\Support\ServiceProvider; use Modules\Contact\Entities\ContactRequest; +use Modules\Contact\Events\Handlers\RegisterContactSidebar; use Modules\Contact\Repositories\Cache\CacheContactRequestDecorator; use Modules\Contact\Repositories\ContactRequestRepository; use Modules\Contact\Repositories\Eloquent\EloquentContactRequestRepository; +use Modules\Core\Events\BuildingSidebar; +use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanPublishConfiguration; class ContactServiceProvider extends ServiceProvider { - use CanPublishConfiguration; + use CanPublishConfiguration, CanGetSidebarClassForModule; /** * Indicates if loading of the provider is deferred. * @@ -29,6 +32,11 @@ public function register() { $this->registerBindings(); $this->registerFactories(); + + $this->app['events']->listen( + BuildingSidebar::class, + $this->getSidebarClassForModule('contact', RegisterContactSidebar::class) + ); } public function boot() diff --git a/changelog.yml b/changelog.yml new file mode 100644 index 0000000..e4a6b12 --- /dev/null +++ b/changelog.yml @@ -0,0 +1,9 @@ +url: https://github.com/AsgardCms/Block +versions: + "3.0.0": + added: + - AsgardCMS v3 support + - Read the sidebar position from configuration file, default to 15 + - New RegisterContactSidebar class + changed: + - Removed usages of URL::route() in favor of route()