add constante for the app id and the app name

This commit is contained in:
Simon Vieille
2020-09-21 11:28:55 +02:00
parent 78c95c58ff
commit 9a67c165bd
9 changed files with 89 additions and 77 deletions
+10 -6
View File
@@ -33,12 +33,16 @@ class Application extends App
*/
protected $user;
public const APP_ID = 'side_menu';
public const APP_NAME = 'Side menu';
/**
* {@inheritdoc}
*/
public function __construct(array $urlParams = [])
{
parent::__construct('side_menu', $urlParams);
parent::__construct(self::APP_ID, $urlParams);
$this->config = OC::$server->getConfig();
$this->cspnm = OC::$server->getContentSecurityPolicyNonceManager();
@@ -53,7 +57,7 @@ class Application extends App
$enabled = true;
if (null !== $this->user) {
$enabled = (bool) $this->config->getUserValue($this->user->getUid(), 'side_menu', 'enabled', '1');
$enabled = (bool) $this->config->getUserValue($this->user->getUid(), self::APP_ID, 'enabled', '1');
}
return $enabled;
@@ -76,20 +80,20 @@ class Application extends App
*/
public function registerAssets()
{
Util::addScript('side_menu', 'sideMenu');
Util::addStyle('side_menu', 'sideMenu');
Util::addScript(self::APP_ID, 'sideMenu');
Util::addStyle(self::APP_ID, 'sideMenu');
$stylesheet = OC::$server->getURLGenerator()->linkToRoute(
'side_menu.Css.stylesheet',
[
'v' => $this->config->getAppValue('side_menu', 'cache', '0'),
'v' => $this->config->getAppValue(self::APP_ID, 'cache', '0'),
]
);
$script = OC::$server->getURLGenerator()->linkToRoute(
'side_menu.Js.script',
[
'v' => $this->config->getAppValue('side_menu', 'cache', '0'),
'v' => $this->config->getAppValue(self::APP_ID, 'cache', '0'),
]
);