Open larry-tx opened 9 years ago
To fix the problem with having to select the theme twice, wrap the cookie reader in a conditional to look for a POST first (in Bootstrap.php):
if (\Yii::$app->request->post('theme_picker') !== null && in_array(\Yii::$app->request->post('theme_picker'), $themes, true)){
$themeName = \Yii::$app->request->post('theme_picker');
} else {
$themeName = \Yii::$app->getRequest()->getCookies()->getValue('theme_picker');
}
Add a similar conditional in ThemePicker.php so that the drop-down theme list will also show the selected theme prior to the cookie being reset by the POST.
Alternatively, as my colleague has pointed out to me, one could simply reload the page after the cookie has been set in ThemePicker.php:
self::setCookie(\Yii::$app->request->post('theme_picker'));
\Yii::$app->response->redirect(\yii\helpers\Url::to(\Yii::$app->request->getUrl()));
Your Themepicker extension seems to be an excellent resource. However, I am having difficulty set $themePath in a variation of the advanced template. Specifically, my directory structure looks like this:
I have tried multiple ways to define the $themePath variable so that it works and have gotten there, sort of. I can easily get the dropdown to correctly display all my themes by doing this:
However, when I try to switch themes, it falls apart because the css file that is handed off has a bizarre path in it. Specifically, the path is:
The path should be:
I'm also using themes from ThemeFactory.net which has the
<THEME_NAME/files/main_style.css
way of storing the theme.I've tried in vain to find out where that actual, bizarre path is coming from and how to reset it. I'm not sure if it's coming from your extension or elsewhere.
Can you give me any help on this?
Actually, I just answered my own question. I modified the Themepicker bootstrap.php file to read:
You might want to consider including this in your somewhat scanty instructions. I took me quite a while to figure it all out.
Now I have two additional issues.
First, when attempting to switch themes, I have to choose the same theme from the dropdown TWICE before it will actually change. Selecting it just once does nothing.
Second, there don't seem to be any hooks for styling the widget. I'd like to include in my topnav navbar, but that requires adding some very specific classes and such to the select. Do you have any suggestions?