diff options
-rw-r--r-- | engine/classes/ElggMenuItem.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 0204a85c7..0538ed64c 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -24,6 +24,11 @@ class ElggMenuItem { protected $href = null; /** + * @var string The string to display if link is clicked + */ + protected $confirm = ''; + + /** * @var array Classes to apply to the anchor tag. */ protected $linkClass = array(); @@ -249,6 +254,26 @@ class ElggMenuItem { } /** + * Set the confirm text shown when link is clicked + * + * @param string $text The text to show + * + * @return void + */ + public function setConfirmText($text) { + $this->confirm = $text; + } + + /** + * Get the confirm text + * + * @return string + */ + public function getConfirmText() { + return $this->confirm; + } + + /** * Set the anchor class * * @param mixed $class An array of class names, or a single string class name. @@ -444,6 +469,11 @@ class ElggMenuItem { $vars['is_action'] = $this->is_action; } + if ($this->confirm) { + $vars['confirm'] = $this->confirm; + return elgg_view('output/confirmlink', $vars); + } + return elgg_view('output/url', $vars); } } |