Skip to content

Commit

Permalink
main fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jirisvoboda committed Jun 17, 2015
1 parent e6dc0bd commit 6b0a0c9
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions Metronic.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* @link http://www.digitaldeals.cz/
* @copyright Copyright (c) 2014 Digital Deals s.r.o.
Expand All @@ -23,6 +22,11 @@ class Metronic extends \yii\base\Component {
*/
public static $assetsBundle;

/**
* Assets link
*/
const ASSETS_LINK = __DIR__.'/assets';

/**
* Theme
*/
Expand Down Expand Up @@ -207,6 +211,11 @@ class Metronic extends \yii\base\Component {
*/
public $footerOption = self::FOOTER_DEFAULT;

/**
* @var array resources paths
*/
public $resources;

/**
* @var string Component name used in the application
*/
Expand All @@ -221,13 +230,23 @@ public function init()

if ($htmlClass != self::CLASS_HTML)
{
throw new InvalidConfigException('Default Yii2 Html helper class is not allowed. For using Metronic theme put Yii::$classMap[\'yii\\helpers\\Html\'] = \'' . self::CLASS_HTML . '\'; into your bootstrap.php');
throw new InvalidConfigException('Default Yii2 Html helper class is not allowed. For using Metronic theme put Yii::$classMap[\'yii\\helpers\\Html\'] = \''.self::CLASS_HTML.'\'; into your bootstrap.php');
}

if (self::SIDEBAR_FIXED === $this->sidebarOption && self::SIDEBAR_MENU_HOVER === $this->sidebarMenu)
{
throw new InvalidConfigException('Hover Sidebar Menu is not compatible with Fixed Sidebar Mode. Select Default Sidebar Mode Instead.');
}

if (!$this->resources)
{
throw new InvalidConfigException('You have to specify resources locations to be able to create symbolic links. Specify "admin" and "global" theme folder locations.');
}

if (!is_link(self::ASSETS_LINK))
{
symlink($this->resources, self::ASSETS_LINK);
}
}

public function parseAssetsParams(&$string)
Expand Down Expand Up @@ -272,5 +291,4 @@ public static function registerThemeAsset($view)
{
return static::$assetsBundle = ThemeAsset::register($view);
}

}
}

0 comments on commit 6b0a0c9

Please sign in to comment.