mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Enh: Allow any url route as homepage
This commit is contained in:
parent
7f43a506a3
commit
16bfea0d50
@ -9,6 +9,8 @@
|
|||||||
namespace humhub\components;
|
namespace humhub\components;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
use yii\base\Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@ -21,6 +23,11 @@ class Application extends \yii\web\Application
|
|||||||
*/
|
*/
|
||||||
public $controllerNamespace = 'humhub\\controllers';
|
public $controllerNamespace = 'humhub\\controllers';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string|array the homepage url
|
||||||
|
*/
|
||||||
|
private $_homeUrl = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -39,6 +46,28 @@ class Application extends \yii\web\Application
|
|||||||
parent::bootstrap();
|
parent::bootstrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the homepage URL
|
||||||
|
*/
|
||||||
|
public function getHomeUrl()
|
||||||
|
{
|
||||||
|
if ($this->_homeUrl === null) {
|
||||||
|
throw new Exception('Home URL not defined!');
|
||||||
|
} elseif (is_array($this->_homeUrl)) {
|
||||||
|
return Url::to($this->_homeUrl);
|
||||||
|
} else {
|
||||||
|
return $this->_homeUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|array $value the homepage URL
|
||||||
|
*/
|
||||||
|
public function setHomeUrl($value)
|
||||||
|
{
|
||||||
|
$this->_homeUrl = $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
$config = [
|
$config = [
|
||||||
'id' => 'humhub',
|
'id' => 'humhub',
|
||||||
'bootstrap' => ['humhub\components\bootstrap\LanguageSelector'],
|
'bootstrap' => ['humhub\components\bootstrap\LanguageSelector'],
|
||||||
'defaultRoute' => '/dashboard/dashboard',
|
'homeUrl' => ['/dashboard/dashboard'],
|
||||||
|
'defaultRoute' => '/home',
|
||||||
'layoutPath' => '@humhub/views/layouts',
|
'layoutPath' => '@humhub/views/layouts',
|
||||||
'components' => [
|
'components' => [
|
||||||
'request' => [
|
'request' => [
|
||||||
|
33
protected/humhub/controllers/HomeController.php
Normal file
33
protected/humhub/controllers/HomeController.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @link https://www.humhub.org/
|
||||||
|
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
|
||||||
|
* @license https://www.humhub.com/licences
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace humhub\controllers;
|
||||||
|
|
||||||
|
use humhub\components\Controller;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HomeController redirects to the home page
|
||||||
|
*
|
||||||
|
* @author luke
|
||||||
|
* @since 1.2
|
||||||
|
*/
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirects to the home controller/action
|
||||||
|
*
|
||||||
|
* @return \yii\web\Response
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
return $this->redirect(Url::home());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -91,6 +91,7 @@ HumHub Change Log
|
|||||||
- Fix: Better notification compatiblity - mail views and enabled WebNotificationTarget
|
- Fix: Better notification compatiblity - mail views and enabled WebNotificationTarget
|
||||||
- Fix #2312: Pinned post appears twice on stream
|
- Fix #2312: Pinned post appears twice on stream
|
||||||
- Enh: Added option to show/hide deactivated user content in stream
|
- Enh: Added option to show/hide deactivated user content in stream
|
||||||
|
- Enh: Allow any url route as homepage by homeUrl array application parameter
|
||||||
|
|
||||||
|
|
||||||
1.2.0-beta.2 (February 24, 2017)
|
1.2.0-beta.2 (February 24, 2017)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user