From 5991e7a915191a0d7655b51794dfdc1ac05ce5d7 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 7 Mar 2011 12:13:19 +0000 Subject: added support for confirm text to ElggMenuItem git-svn-id: http://code.elgg.org/elgg/trunk@8621 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMenuItem.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'engine/classes/ElggMenuItem.php') 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 @@ -23,6 +23,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. */ @@ -248,6 +253,26 @@ class ElggMenuItem { return $this->title; } + /** + * 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 * @@ -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); } } -- cgit v1.2.3