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
67ab030c
Unverified
Commit
67ab030c
authored
Jul 18, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Splitting up the EditorIsRendering to its own view composer
parent
9487e5be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
4 deletions
+31
-4
AssetsViewComposer.php
Modules/Core/Composers/AssetsViewComposer.php
+0
-3
EditorViewComposer.php
Modules/Core/Composers/EditorViewComposer.php
+29
-0
composers.php
Modules/Core/composers.php
+2
-1
No files found.
Modules/Core/Composers/AssetsViewComposer.php
View file @
67ab030c
...
...
@@ -5,7 +5,6 @@ namespace Modules\Core\Composers;
use
Illuminate\Contracts\View\View
;
use
Illuminate\Http\Request
;
use
Modules\Core\Events\CollectingAssets
;
use
Modules\Core\Events\EditorIsRendering
;
use
Modules\Core\Foundation\Asset\Manager\AssetManager
;
use
Modules\Core\Foundation\Asset\Pipeline\AssetPipeline
;
use
Modules\Core\Foundation\Asset\Types\AssetTypeFactory
;
...
...
@@ -50,11 +49,9 @@ class AssetsViewComposer
$this
->
assetPipeline
->
requireCss
(
config
(
'asgard.core.core.admin-required-assets.css'
));
$this
->
assetPipeline
->
requireJs
(
config
(
'asgard.core.core.admin-required-assets.js'
));
event
(
$editor
=
new
EditorIsRendering
(
$this
->
assetPipeline
));
event
(
new
CollectingAssets
(
$this
->
assetPipeline
));
$view
->
with
(
'cssFiles'
,
$this
->
assetPipeline
->
allCss
());
$view
->
with
(
'jsFiles'
,
$this
->
assetPipeline
->
allJs
());
$view
->
with
(
'editor'
,
$editor
);
}
}
Modules/Core/Composers/EditorViewComposer.php
0 → 100644
View file @
67ab030c
<?php
namespace
Modules\Core\Composers
;
use
Illuminate\Contracts\View\View
;
use
Modules\Core\Events\EditorIsRendering
;
use
Modules\Core\Foundation\Asset\Pipeline\AssetPipeline
;
class
EditorViewComposer
{
/**
* @var AssetPipeline
*/
private
$assetPipeline
;
public
function
__construct
(
AssetPipeline
$assetPipeline
)
{
$this
->
assetPipeline
=
$assetPipeline
;
}
public
function
compose
(
View
$view
)
{
if
(
app
(
'asgard.onBackend'
)
===
false
)
{
return
;
}
event
(
$editor
=
new
EditorIsRendering
(
$this
->
assetPipeline
));
$view
->
with
(
'editor'
,
$editor
);
}
}
Modules/Core/composers.php
View file @
67ab030c
...
...
@@ -7,4 +7,5 @@ view()->composer('core::fields.select-theme', \Modules\Core\Composers\ThemeCompo
view
()
->
composer
(
'core::fields.select-locales'
,
\Modules\Core\Composers\SettingLocalesComposer
::
class
);
view
()
->
composer
(
'*'
,
\Modules\Core\Composers\LocaleComposer
::
class
);
view
()
->
composer
(
'*'
,
\Modules\Core\Composers\CurrentUserViewComposer
::
class
);
view
()
->
composer
(
'*'
,
\Modules\Core\Composers\AssetsViewComposer
::
class
);
view
()
->
composer
(
'layouts.master'
,
\Modules\Core\Composers\AssetsViewComposer
::
class
);
view
()
->
composer
(
'*'
,
\Modules\Core\Composers\EditorViewComposer
::
class
);
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