Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
c32def86
Commit
c32def86
authored
Apr 18, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
turn asset manager into a getter.
parent
90b2a54f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
ViewContent.php
framework/base/ViewContent.php
+18
-15
No files found.
framework/base/ViewContent.php
View file @
c32def86
...
...
@@ -24,11 +24,6 @@ class ViewContent extends Component
const
TOKEN_BODY_BEGIN
=
'<![CDATA[YII-BLOCK-BODY-BEGIN]]>'
;
const
TOKEN_BODY_END
=
'<![CDATA[YII-BLOCK-BODY-END]]>'
;
/**
* @var \yii\web\AssetManager
*/
public
$assetManager
;
public
$assetBundles
;
public
$title
;
public
$metaTags
;
...
...
@@ -42,14 +37,6 @@ class ViewContent extends Component
public
$jsInBody
;
public
$jsFilesInBody
;
public
function
init
()
{
parent
::
init
();
if
(
$this
->
assetManager
===
null
)
{
$this
->
assetManager
=
Yii
::
$app
->
getAssets
();
}
}
public
function
reset
()
{
$this
->
title
=
null
;
...
...
@@ -64,6 +51,21 @@ class ViewContent extends Component
$this
->
jsInBody
=
null
;
$this
->
jsFilesInBody
=
null
;
}
private
$_assetManager
;
/**
* @return \yii\web\AssetManager
*/
public
function
getAssetManager
()
{
return
$this
->
_assetManager
?:
Yii
::
$app
->
getAssets
();
}
public
function
setAssetManager
(
$value
)
{
$this
->
_assetManager
=
$value
;
}
public
function
begin
()
{
...
...
@@ -95,10 +97,11 @@ class ViewContent extends Component
public
function
registerAssetBundle
(
$name
)
{
if
(
!
isset
(
$this
->
assetBundles
[
$name
]))
{
$bundle
=
$this
->
assetManager
->
getBundle
(
$name
);
$am
=
$this
->
getAssetManager
();
$bundle
=
$am
->
getBundle
(
$name
);
if
(
$bundle
!==
null
)
{
$this
->
assetBundles
[
$name
]
=
false
;
$bundle
->
registerAssets
(
$this
,
$
this
->
assetManager
);
$bundle
->
registerAssets
(
$this
,
$
am
);
$this
->
assetBundles
[
$name
]
=
true
;
}
else
{
throw
new
InvalidConfigException
(
"Unknown asset bundle:
$name
"
);
...
...
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