Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
feat: Added showOnTopMenu to attributes of Module
Browse files Browse the repository at this point in the history
Fixed #44
  • Loading branch information
githubjeka committed Feb 2, 2021
1 parent 3f77036 commit 0b37652
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ public static function onTopMenuInit(Event $event)
return;
}

if (\Yii::$app->getModule('tracker-issues')->showOnTopMenu === false) {
return;
}

$controller = \Yii::$app->controller;
/** @var $module */
$module = $controller->module;

$event->sender->addItem([
Expand Down
12 changes: 7 additions & 5 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Module extends ContentContainerModule
public $id = 'tracker-issues';

public $documentRootPath;
/** @var bool */
public $showOnTopMenu = true;

public $resourcesPath = 'resources';

Expand Down Expand Up @@ -63,11 +65,6 @@ public function getPermissions($contentContainer = null)
];
}

public static function getIdentifier()
{
return 'tracker-issues';
}

/**
* @inheritdoc
*/
Expand All @@ -85,4 +82,9 @@ public function getConfigUrl()
{
return Url::to(['/' . $this->getIdentifier() . '/config']);
}

public static function getIdentifier()
{
return 'tracker-issues';
}
}

0 comments on commit 0b37652

Please sign in to comment.