aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/Menu
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2017-09-02 17:11:15 +0200
committerAndreas Gohr <andi@splitbrain.org>2017-09-02 17:27:59 +0200
commit50ca245c235eb2ced9a0897638df2d5c0a12b55d (patch)
tree243bcb24550e379c1d61ff8d5af2131da35fb0ac /inc/Menu
parentc084674af086699d4ec7262daf65e1de920e8994 (diff)
downloaddokuwiki-50ca245c235eb2ced9a0897638df2d5c0a12b55d.tar.gz
dokuwiki-50ca245c235eb2ced9a0897638df2d5c0a12b55d.zip
MenuItems: add possibility to set a different title attribute
Diffstat (limited to 'inc/Menu')
-rw-r--r--inc/Menu/Item/AbstractItem.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/inc/Menu/Item/AbstractItem.php b/inc/Menu/Item/AbstractItem.php
index a36be5c40..1f3574776 100644
--- a/inc/Menu/Item/AbstractItem.php
+++ b/inc/Menu/Item/AbstractItem.php
@@ -44,6 +44,8 @@ abstract class AbstractItem {
protected $svg = DOKU_INC . 'lib/images/menu/00-default_checkbox-blank-circle-outline.svg';
/** @var string can be set to overwrite the default lookup in $lang.btn_* */
protected $label = '';
+ /** @var string the tooltip title, defaults to $label */
+ protected $title = '';
/** @var int the context this titme is shown in */
protected $context = self::CTX_ALL;
@@ -88,6 +90,19 @@ abstract class AbstractItem {
}
/**
+ * Return this item's title
+ *
+ * This title should be used to display a tooltip (using the HTML title attribute). If
+ * a title property was not explicitly set, the label will be returned.
+ *
+ * @return string
+ */
+ public function getTitle() {
+ if($this->title === '') return $this->getLabel();
+ return $this->title;
+ }
+
+ /**
* Return the link this item links to
*
* Basically runs wl() on $id and $params. However if the ID is a hash it is used directly
@@ -116,7 +131,7 @@ abstract class AbstractItem {
public function getLinkAttributes($classprefix = 'menuitem ') {
$attr = array(
'href' => $this->getLink(),
- 'title' => $this->getLabel(),
+ 'title' => $this->getTitle(),
);
if($this->isNofollow()) $attr['rel'] = 'nofollow';
if($this->getAccesskey()) {