aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggMenuItem.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-06-20 17:16:35 -0700
committerCash Costello <cash.costello@gmail.com>2011-06-20 17:16:35 -0700
commit2ca57a9822765ca0d8504d736b677ad6af22c61b (patch)
tree31b6868b3876dcc53937ed0a10a113f6e315ab3e /engine/classes/ElggMenuItem.php
parent8edfc55bc7ee99955b3c82a59312df8c9d840bb7 (diff)
parent02840336736e2b827c1c073246785bde260222f6 (diff)
downloadelgg-2ca57a9822765ca0d8504d736b677ad6af22c61b.tar.gz
elgg-2ca57a9822765ca0d8504d736b677ad6af22c61b.tar.bz2
Merge pull request #43 from lie2815/3486-menu-item-set-href
Fixes #3486 Add setHref() method to ElggMenuItem class
Diffstat (limited to 'engine/classes/ElggMenuItem.php')
-rw-r--r--engine/classes/ElggMenuItem.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index 157ed9ceb..d76518be2 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -132,7 +132,7 @@ class ElggMenuItem {
$item->setItemClass($options['item_class']);
unset($options['item_class']);
}
-
+
foreach ($options as $key => $value) {
$item->$key = $value;
}
@@ -164,6 +164,15 @@ class ElggMenuItem {
}
/**
+ * Set the URL of the menu item
+ *
+ * @return void
+ */
+ public function setHref($href) {
+ $this->href = $href;
+ }
+
+ /**
* Get the URL of the menu item
*
* @return string
@@ -465,7 +474,7 @@ class ElggMenuItem {
* @params array $vars Options to pass to output/url if a link
*
* @return string
- *
+ *
* @todo View code in a model. How do we feel about that?
*/
public function getContent(array $vars = array()) {
@@ -475,7 +484,7 @@ class ElggMenuItem {
}
$vars['text'] = $this->text;
-
+
if ($this->href) {
$vars['href'] = $this->href;
}
@@ -483,15 +492,15 @@ class ElggMenuItem {
if ($this->linkClass) {
$vars['class'] = $this->getLinkClass();
}
-
+
if ($this->rel) {
$vars['rel'] = $this->rel;
}
-
+
if ($this->title) {
$vars['title'] = $this->title;
}
-
+
if ($this->is_action) {
$vars['is_action'] = $this->is_action;
}