]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added support for confirm text to ElggMenuItem
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 7 Mar 2011 12:13:19 +0000 (12:13 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 7 Mar 2011 12:13:19 +0000 (12:13 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8621 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/classes/ElggMenuItem.php

index 0204a85c7981bc0a6592c1ffbac98e4ffe30a7d0..0538ed64c9323190746e58a08842f64aeb3cc0c2 100644 (file)
@@ -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);
        }
 }