public function addFlash($type, $error = null)
    {
        if ($type === 'error' && is_string($error) && !empty($error)) {
            $text = Yii::t('hipanel', $error);
        } else {
            $text = $this->getFlashText($type);
        }

        if ($type instanceof Closure) {
            $text = call_user_func($text, $text, $this);
        }

        Yii::$app->session->addFlash($type, [
            'text' => $text,
        ]);
    }