Skip to content

Commit

Permalink
Issue #33: Add error handling to example dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaertl committed Jul 1, 2015
1 parent e5eb029 commit 1b308f9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,14 @@ class LanguageDropdown extends Dropdown
{
private static $_labels;

private $_isError;

public function init()
{
$route = '/'.Yii::$app->controller->route;
$appLanguage = Yii::$app->language;
$params = $_GET;
$this->_isError = $route === Yii::$app->errroHandler->errorAction;

array_unshift($params, $route);

Expand All @@ -320,6 +323,16 @@ class LanguageDropdown extends Dropdown
parent::init();
}

public function run()
{
// Only show this widget if we're not on the error page
if ($this->_isError) {
return '';
} else {
return parent::run();
}
}

public static function label($code)
{
if (self::$_labels===null) {
Expand Down

0 comments on commit 1b308f9

Please sign in to comment.