Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
2bcf8096
Unverified
Commit
2bcf8096
authored
Jul 21, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Register the Media sidebar via event hook. Remove old sidebar extender
parent
1bbdb611
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
24 deletions
+12
-24
RegisterMediaSidebar.php
Modules/Media/Events/Handlers/RegisterMediaSidebar.php
+3
-23
MediaServiceProvider.php
Modules/Media/Providers/MediaServiceProvider.php
+9
-1
No files found.
Modules/Media/
Sidebar/SidebarExtende
r.php
→
Modules/Media/
Events/Handlers/RegisterMediaSideba
r.php
View file @
2bcf8096
<?php
namespace
Modules\Media\
Sidebar
;
namespace
Modules\Media\
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\SidebarExtende
r
class
RegisterMediaSidebar
extends
AbstractAdminSideba
r
{
/**
* @var Authentication
*/
protected
$auth
;
/**
* @param Authentication $auth
*
* @internal param Guard $guard
*/
public
function
__construct
(
Authentication
$auth
)
{
$this
->
auth
=
$auth
;
}
/**
* @param Menu $menu
*
* @return Menu
*/
public
function
extendWith
(
Menu
$menu
)
{
$menu
->
group
(
trans
(
'core::sidebar.content'
),
function
(
Group
$group
)
{
...
...
Modules/Media/Providers/MediaServiceProvider.php
View file @
2bcf8096
...
...
@@ -5,6 +5,8 @@ namespace Modules\Media\Providers;
use
Illuminate\Contracts\Events\Dispatcher
as
DispatcherContract
;
use
Illuminate\Support\Facades\Validator
;
use
Illuminate\Support\ServiceProvider
;
use
Modules\Core\Events\BuildingSidebar
;
use
Modules\Core\Traits\CanGetSidebarClassForModule
;
use
Modules\Core\Traits\CanPublishConfiguration
;
use
Modules\Media\Blade\MediaMultipleDirective
;
use
Modules\Media\Blade\MediaSingleDirective
;
...
...
@@ -14,6 +16,7 @@ use Modules\Media\Contracts\DeletingMedia;
use
Modules\Media\Contracts\StoringMedia
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Events\Handlers\HandleMediaStorage
;
use
Modules\Media\Events\Handlers\RegisterMediaSidebar
;
use
Modules\Media\Events\Handlers\RemovePolymorphicLink
;
use
Modules\Media\Image\ThumbnailManager
;
use
Modules\Media\Repositories\Eloquent\EloquentFileRepository
;
...
...
@@ -22,7 +25,7 @@ use Modules\Tag\Repositories\TagManager;
class
MediaServiceProvider
extends
ServiceProvider
{
use
CanPublishConfiguration
;
use
CanPublishConfiguration
,
CanGetSidebarClassForModule
;
/**
* Indicates if loading of the provider is deferred.
*
...
...
@@ -50,6 +53,11 @@ class MediaServiceProvider extends ServiceProvider
$this
->
app
->
bind
(
'media.thumbnail.directive'
,
function
()
{
return
new
MediaThumbnailDirective
();
});
$this
->
app
[
'events'
]
->
listen
(
BuildingSidebar
::
class
,
$this
->
getSidebarClassForModule
(
'media'
,
RegisterMediaSidebar
::
class
)
);
}
public
function
boot
(
DispatcherContract
$events
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment