Commit c852ba45 by Alexander Makarov

Merge pull request #5617 from pana1990/patch-1

refactoring code
parents 8c50ee9e 8c8b7a77
......@@ -51,9 +51,6 @@ class AssetPanel extends Panel
public function save()
{
$bundles = Yii::$app->view->assetManager->bundles;
if (empty($bundles)) {
return [];
}
$data = [];
foreach ($bundles as $name => $bundle) {
if ($bundle instanceof AssetBundle) {
......@@ -65,9 +62,9 @@ class AssetPanel extends Panel
/**
* Additional formatting for view.
*
*
* @param AssetBundle[] $bundles Array of bundles to formatting.
*
*
* @return AssetManager
*/
protected function format(array $bundles)
......@@ -76,7 +73,7 @@ class AssetPanel extends Panel
$this->cssCount += count($bundle->css);
$this->jsCount += count($bundle->js);
array_walk($bundle->css, function(&$file, $key, $userdata) {
$file = Html::a($file, $userdata->baseUrl . '/' . $file, ['target' => '_blank']);
}, $bundle);
......@@ -88,18 +85,18 @@ class AssetPanel extends Panel
array_walk($bundle->depends, function(&$depend) {
$depend = Html::a($depend, '#' . $depend);
});
$this->formatOptions($bundle->publishOptions);
$this->formatOptions($bundle->jsOptions);
$this->formatOptions($bundle->cssOptions);
}
return $bundles;
}
/**
* Format associative array of params to simple value.
*
*
* @param array $params
*
* @return array
......@@ -109,11 +106,11 @@ class AssetPanel extends Panel
if (!is_array($params)) {
return $params;
}
foreach ($params as $param => $value) {
$params[$param] = Html::tag('strong', '\'' . $param . '\' => ') . (string) $value;
}
return $params;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment