Commit 8c8b7a77 by pana1990

refactoring code

parent 8c50ee9e
...@@ -51,9 +51,6 @@ class AssetPanel extends Panel ...@@ -51,9 +51,6 @@ class AssetPanel extends Panel
public function save() public function save()
{ {
$bundles = Yii::$app->view->assetManager->bundles; $bundles = Yii::$app->view->assetManager->bundles;
if (empty($bundles)) {
return [];
}
$data = []; $data = [];
foreach ($bundles as $name => $bundle) { foreach ($bundles as $name => $bundle) {
if ($bundle instanceof AssetBundle) { if ($bundle instanceof AssetBundle) {
...@@ -65,9 +62,9 @@ class AssetPanel extends Panel ...@@ -65,9 +62,9 @@ class AssetPanel extends Panel
/** /**
* Additional formatting for view. * Additional formatting for view.
* *
* @param AssetBundle[] $bundles Array of bundles to formatting. * @param AssetBundle[] $bundles Array of bundles to formatting.
* *
* @return AssetManager * @return AssetManager
*/ */
protected function format(array $bundles) protected function format(array $bundles)
...@@ -76,7 +73,7 @@ class AssetPanel extends Panel ...@@ -76,7 +73,7 @@ class AssetPanel extends Panel
$this->cssCount += count($bundle->css); $this->cssCount += count($bundle->css);
$this->jsCount += count($bundle->js); $this->jsCount += count($bundle->js);
array_walk($bundle->css, function(&$file, $key, $userdata) { array_walk($bundle->css, function(&$file, $key, $userdata) {
$file = Html::a($file, $userdata->baseUrl . '/' . $file, ['target' => '_blank']); $file = Html::a($file, $userdata->baseUrl . '/' . $file, ['target' => '_blank']);
}, $bundle); }, $bundle);
...@@ -88,18 +85,18 @@ class AssetPanel extends Panel ...@@ -88,18 +85,18 @@ class AssetPanel extends Panel
array_walk($bundle->depends, function(&$depend) { array_walk($bundle->depends, function(&$depend) {
$depend = Html::a($depend, '#' . $depend); $depend = Html::a($depend, '#' . $depend);
}); });
$this->formatOptions($bundle->publishOptions); $this->formatOptions($bundle->publishOptions);
$this->formatOptions($bundle->jsOptions); $this->formatOptions($bundle->jsOptions);
$this->formatOptions($bundle->cssOptions); $this->formatOptions($bundle->cssOptions);
} }
return $bundles; return $bundles;
} }
/** /**
* Format associative array of params to simple value. * Format associative array of params to simple value.
* *
* @param array $params * @param array $params
* *
* @return array * @return array
...@@ -109,11 +106,11 @@ class AssetPanel extends Panel ...@@ -109,11 +106,11 @@ class AssetPanel extends Panel
if (!is_array($params)) { if (!is_array($params)) {
return $params; return $params;
} }
foreach ($params as $param => $value) { foreach ($params as $param => $value) {
$params[$param] = Html::tag('strong', '\'' . $param . '\' => ') . (string) $value; $params[$param] = Html::tag('strong', '\'' . $param . '\' => ') . (string) $value;
} }
return $params; 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