Enh: Added config option to remove "user profile posts" entry from directory navigation

This commit is contained in:
Lucas Bartholemy 2018-10-23 15:06:08 +02:00
parent 71306be738
commit 8daedb2b44
3 changed files with 20 additions and 7 deletions

View File

@ -10,6 +10,7 @@ HumHub Change Log
- Enh: Add less options for mail font url/family (@rekollekt)
- Fix: Fixed typo in space (un-)archived activities
- Enh: Removed ErrorEvent which will be removed in yii-queue 3.0 (@acs-ferreira)
- Enh: Added config option to remove "user profile posts" entry from directory navigation
1.3.6 (October 11, 2018)

View File

@ -50,6 +50,12 @@ class Module extends \humhub\components\Module
*/
public $guestAccess = true;
/**
* @var bool show menu entry for user profile posts on directory
*/
public $showUserProfilePosts = true;
/**
* @return bool checks if the current user can access the directory
*/

View File

@ -8,6 +8,7 @@
namespace humhub\modules\directory\widgets;
use humhub\modules\directory\Module;
use Yii;
use yii\helpers\Url;
@ -26,6 +27,9 @@ class Menu extends \humhub\widgets\BaseMenu
public function init()
{
/** @var Module $module */
$module = Yii::$app->getModule('directory');
$this->addItemGroup([
'id' => 'directory',
'label' => Yii::t('DirectoryModule.base', '<strong>Directory</strong> menu'),
@ -58,13 +62,15 @@ class Menu extends \humhub\widgets\BaseMenu
'isActive' => (Yii::$app->controller->action->id == "spaces"),
]);
$this->addItem([
'label' => Yii::t('DirectoryModule.base', 'User profile posts'),
'group' => 'directory',
'url' => Url::to(['/directory/directory/user-posts']),
'sortOrder' => 400,
'isActive' => (Yii::$app->controller->action->id == "user-posts"),
]);
if ($module->showUserProfilePosts) {
$this->addItem([
'label' => Yii::t('DirectoryModule.base', 'User profile posts'),
'group' => 'directory',
'url' => Url::to(['/directory/directory/user-posts']),
'sortOrder' => 400,
'isActive' => (Yii::$app->controller->action->id == "user-posts"),
]);
}
parent::init();
}