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
ee2d93b1
Commit
ee2d93b1
authored
Apr 16, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scripts WIP
parent
0416e014
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
3 deletions
+36
-3
ViewContent.php
framework/base/ViewContent.php
+1
-1
AssetBundle.php
framework/web/AssetBundle.php
+20
-1
AssetManager.php
framework/web/AssetManager.php
+15
-1
No files found.
framework/base/ViewContent.php
View file @
ee2d93b1
...
...
@@ -98,7 +98,7 @@ class ViewContent extends Component
$bundle
=
$this
->
assetManager
->
getBundle
(
$name
);
if
(
$bundle
!==
null
)
{
$this
->
assetBundles
[
$name
]
=
false
;
$bundle
->
register
With
(
$this
);
$bundle
->
register
Assets
(
$this
);
$this
->
assetBundles
[
$name
]
=
true
;
}
else
{
throw
new
InvalidConfigException
(
"Unknown asset bundle:
$name
"
);
...
...
framework/web/AssetBundle.php
View file @
ee2d93b1
...
...
@@ -42,10 +42,18 @@ class AssetBundle extends Object
public
$css
=
array
();
public
$depends
=
array
();
public
function
mapTo
(
$target
)
{
$this
->
depends
=
array
(
$target
);
$this
->
js
=
$this
->
css
=
array
();
$this
->
basePath
=
null
;
$this
->
baseUrl
=
null
;
}
/**
* @param \yii\base\ViewContent $content
*/
public
function
register
With
(
$content
)
public
function
register
Assets
(
$content
)
{
foreach
(
$this
->
depends
as
$name
)
{
$content
->
registerAssetBundle
(
$name
);
...
...
@@ -65,4 +73,14 @@ class AssetBundle extends Object
}
}
}
/**
* @param \yii\web\AssetManager $assetManager
*/
public
function
publish
(
$assetManager
)
{
if
(
$this
->
basePath
!==
null
&&
$this
->
baseUrl
===
null
)
{
return
;
}
}
}
\ No newline at end of file
framework/web/AssetManager.php
View file @
ee2d93b1
...
...
@@ -129,9 +129,23 @@ class AssetManager extends Component
$this
->
bundles
[
$name
]
=
Yii
::
createObject
(
$config
);
}
}
/** @var $bundle AssetBundle */
$bundle
=
$this
->
bundles
[
$name
];
if
(
isset
(
$this
->
bundleMap
[
$name
])
&&
is_string
(
$this
->
bundleMap
[
$name
]))
{
$target
=
$this
->
bundleMap
[
$name
];
if
(
!
isset
(
$this
->
bundles
[
$target
]))
{
if
(
isset
(
$this
->
bundleMap
[
$target
]))
{
$this
->
bundles
[
$target
]
=
$this
->
bundleMap
[
$target
];
}
else
{
throw
new
InvalidConfigException
(
"Asset bundle '
$name
' is mapped to an unknown bundle:
$target
"
);
}
}
$bundle
->
mapTo
(
$target
);
unset
(
$this
->
bundleMap
[
$name
]);
}
if
(
$publish
)
{
$bundle
->
publish
(
$this
);
}
return
$this
->
bundles
[
$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