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
b03b38fb
Commit
b03b38fb
authored
Oct 20, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added $publish parameter to AssetManager::getBundle().
parent
1475b462
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
View.php
framework/yii/base/View.php
+1
-1
AssetBundle.php
framework/yii/web/AssetBundle.php
+1
-1
AssetManager.php
framework/yii/web/AssetManager.php
+7
-3
No files found.
framework/yii/base/View.php
View file @
b03b38fb
...
...
@@ -552,7 +552,7 @@ class View extends Component
foreach
(
$bundle
->
depends
as
$dep
)
{
$this
->
registerAssetFiles
(
$dep
);
}
$bundle
->
registerAssets
(
$this
);
$bundle
->
registerAsset
File
s
(
$this
);
unset
(
$this
->
assetBundles
[
$name
]);
}
...
...
framework/yii/web/AssetBundle.php
View file @
b03b38fb
...
...
@@ -133,7 +133,7 @@ class AssetBundle extends Object
* Registers the CSS and JS files with the given view.
* @param \yii\base\View $view the view that the asset files are to be registered with.
*/
public
function
registerAssets
(
$view
)
public
function
registerAsset
File
s
(
$view
)
{
foreach
(
$this
->
js
as
$js
)
{
if
(
strpos
(
$js
,
'/'
)
!==
0
&&
strpos
(
$js
,
'://'
)
===
false
)
{
...
...
framework/yii/web/AssetManager.php
View file @
b03b38fb
...
...
@@ -95,10 +95,12 @@ class AssetManager extends Component
* it will treat `$name` as the class of the asset bundle and create a new instance of it.
*
* @param string $name the class name of the asset bundle
* @param boolean $publish whether to publish the asset files in the asset bundle before it is returned.
* If you set this false, you must manually call `AssetBundle::publish()` to publish the asset files.
* @return AssetBundle the asset bundle instance
* @throws InvalidConfigException if $name does not refer to a valid asset bundle
*/
public
function
getBundle
(
$name
)
public
function
getBundle
(
$name
,
$publish
=
true
)
{
if
(
isset
(
$this
->
bundles
[
$name
]))
{
if
(
$this
->
bundles
[
$name
]
instanceof
AssetBundle
)
{
...
...
@@ -111,8 +113,10 @@ class AssetManager extends Component
}
else
{
$bundle
=
Yii
::
createObject
(
$name
);
}
/** @var AssetBundle $bundle */
$bundle
->
publish
(
$this
);
if
(
$publish
)
{
/** @var AssetBundle $bundle */
$bundle
->
publish
(
$this
);
}
return
$this
->
bundles
[
$name
]
=
$bundle
;
}
...
...
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