Skip to content
Snippets Groups Projects
Commit 4bb2fc4a authored by Andreas Gohr's avatar Andreas Gohr
Browse files

overwrite item properties in constructor only

Othewise weird side effects may happen when a parent constructor
overwrites them again.
parent 90f7713e
No related branches found
No related tags found
No related merge requests found
...@@ -9,13 +9,13 @@ namespace dokuwiki\Menu\Item; ...@@ -9,13 +9,13 @@ namespace dokuwiki\Menu\Item;
*/ */
class Admin extends AbstractItem { class Admin extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/settings.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $INFO; global $INFO;
parent::__construct(); parent::__construct();
$this->svg = DOKU_INC . 'lib/images/menu/settings.svg';
if(!$INFO['ismanager']) { if(!$INFO['ismanager']) {
throw new \RuntimeException("admin is for managers only"); throw new \RuntimeException("admin is for managers only");
} }
......
...@@ -9,6 +9,10 @@ namespace dokuwiki\Menu\Item; ...@@ -9,6 +9,10 @@ namespace dokuwiki\Menu\Item;
*/ */
class Backlink extends AbstractItem { class Backlink extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/08-backlink_link-variant.svg'; /** @inheritdoc */
public function __construct() {
parent::__construct();
$this->svg = DOKU_INC . 'lib/images/menu/08-backlink_link-variant.svg';
}
} }
...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item; ...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item;
*/ */
class Index extends AbstractItem { class Index extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/file-tree.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $conf; global $conf;
...@@ -18,6 +16,7 @@ class Index extends AbstractItem { ...@@ -18,6 +16,7 @@ class Index extends AbstractItem {
parent::__construct(); parent::__construct();
$this->accesskey = 'x'; $this->accesskey = 'x';
$this->svg = DOKU_INC . 'lib/images/menu/file-tree.svg';
// allow searchbots to get to the sitemap from the homepage (when dokuwiki isn't providing a sitemap.xml) // allow searchbots to get to the sitemap from the homepage (when dokuwiki isn't providing a sitemap.xml)
if($conf['start'] == $ID && !$conf['sitemap']) { if($conf['start'] == $ID && !$conf['sitemap']) {
......
...@@ -9,13 +9,12 @@ namespace dokuwiki\Menu\Item; ...@@ -9,13 +9,12 @@ namespace dokuwiki\Menu\Item;
*/ */
class Login extends AbstractItem { class Login extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/login.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $INPUT; global $INPUT;
parent::__construct(); parent::__construct();
$this->svg = DOKU_INC . 'lib/images/menu/login.svg';
$this->params['sectok'] = getSecurityToken(); $this->params['sectok'] = getSecurityToken();
if($INPUT->server->has('REMOTE_USER')) { if($INPUT->server->has('REMOTE_USER')) {
if(!actionOK('logout')) { if(!actionOK('logout')) {
......
...@@ -9,14 +9,13 @@ namespace dokuwiki\Menu\Item; ...@@ -9,14 +9,13 @@ namespace dokuwiki\Menu\Item;
*/ */
class Media extends AbstractItem { class Media extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/folder-multiple-image.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $ID; global $ID;
parent::__construct(); parent::__construct();
$params['ns'] = getNS($ID); $this->svg = DOKU_INC . 'lib/images/menu/folder-multiple-image.svg';
$this->params['ns'] = getNS($ID);
} }
} }
...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item; ...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item;
*/ */
class MediaManager extends AbstractItem { class MediaManager extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/11-mediamanager_folder-image.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $IMG; global $IMG;
...@@ -21,6 +19,8 @@ class MediaManager extends AbstractItem { ...@@ -21,6 +19,8 @@ class MediaManager extends AbstractItem {
if($authNS < AUTH_UPLOAD) { if($authNS < AUTH_UPLOAD) {
throw new \RuntimeException("media manager link only with upload permissions"); throw new \RuntimeException("media manager link only with upload permissions");
} }
$this->svg = DOKU_INC . 'lib/images/menu/11-mediamanager_folder-image.svg';
$this->params = array( $this->params = array(
'ns' => $imgNS, 'ns' => $imgNS,
'image' => $IMG, 'image' => $IMG,
......
...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item; ...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item;
*/ */
class Profile extends AbstractItem { class Profile extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/account-card-details.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $INPUT; global $INPUT;
...@@ -19,6 +17,8 @@ class Profile extends AbstractItem { ...@@ -19,6 +17,8 @@ class Profile extends AbstractItem {
if(!$INPUT->server->str('REMOTE_USER')) { if(!$INPUT->server->str('REMOTE_USER')) {
throw new \RuntimeException("profile is only for logged in users"); throw new \RuntimeException("profile is only for logged in users");
} }
$this->svg = DOKU_INC . 'lib/images/menu/account-card-details.svg';
} }
} }
...@@ -13,6 +13,7 @@ class Revisions extends AbstractItem { ...@@ -13,6 +13,7 @@ class Revisions extends AbstractItem {
public function __construct() { public function __construct() {
parent::__construct(); parent::__construct();
$this->accesskey = 'o';
$this->type = 'revs'; $this->type = 'revs';
$this->svg = DOKU_INC . 'lib/images/menu/07-revisions_history.svg'; $this->svg = DOKU_INC . 'lib/images/menu/07-revisions_history.svg';
} }
......
...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item; ...@@ -9,8 +9,6 @@ namespace dokuwiki\Menu\Item;
*/ */
class Subscribe extends AbstractItem { class Subscribe extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/09-subscribe_email-outline.svg';
/** @inheritdoc */ /** @inheritdoc */
public function __construct() { public function __construct() {
global $INPUT; global $INPUT;
...@@ -19,6 +17,8 @@ class Subscribe extends AbstractItem { ...@@ -19,6 +17,8 @@ class Subscribe extends AbstractItem {
if(!$INPUT->server->str('REMOTE_USER')) { if(!$INPUT->server->str('REMOTE_USER')) {
throw new \RuntimeException("subscribe is only for logged in users"); throw new \RuntimeException("subscribe is only for logged in users");
} }
$this->svg = DOKU_INC . 'lib/images/menu/09-subscribe_email-outline.svg';
} }
} }
...@@ -10,10 +10,15 @@ namespace dokuwiki\Menu\Item; ...@@ -10,10 +10,15 @@ namespace dokuwiki\Menu\Item;
*/ */
class Top extends AbstractItem { class Top extends AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/10-top_arrow-up.svg'; /** @inheritdoc */
protected $accesskey = 't'; public function __construct() {
protected $params = array('do' => ''); parent::__construct();
protected $id = '#dokuwiki__top';
protected $context = self::CTX_DESKTOP; $this->svg = DOKU_INC . 'lib/images/menu/10-top_arrow-up.svg';
$this->accesskey = 't';
$this->params = array('do' => '');
$this->id = '#dokuwiki__top';
$this->context = self::CTX_DESKTOP;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment