aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-24 01:27:47 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-24 01:27:47 +0000
commitc667ce609dc3c1f9f071e39293f8c176d3e1c5dc (patch)
tree1ec44df08297b396809af545dcf9568ba7c27aff /engine/classes
parent64547b21f0e0cb4efc55212a5a6ae92824b274aa (diff)
downloadelgg-c667ce609dc3c1f9f071e39293f8c176d3e1c5dc.tar.gz
elgg-c667ce609dc3c1f9f071e39293f8c176d3e1c5dc.tar.bz2
Refs #2997 switching from title to text for menu items
git-svn-id: http://code.elgg.org/elgg/trunk@8455 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggMenuBuilder.php12
-rw-r--r--engine/classes/ElggMenuItem.php31
2 files changed, 23 insertions, 20 deletions
diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php
index 33abc0c6b..4f9e7b447 100644
--- a/engine/classes/ElggMenuBuilder.php
+++ b/engine/classes/ElggMenuBuilder.php
@@ -176,8 +176,8 @@ class ElggMenuBuilder {
ksort($this->menu);
switch ($sort_by) {
- case 'title':
- $sort_callback = array('ElggMenuBuilder', 'compareByTitle');
+ case 'text':
+ $sort_callback = array('ElggMenuBuilder', 'compareByText');
break;
case 'name':
$sort_callback = array('ElggMenuBuilder', 'compareByName');
@@ -221,15 +221,15 @@ class ElggMenuBuilder {
}
/**
- * Compare two menu items by their titles
+ * Compare two menu items by their display text
*
* @param ElggMenuItem $a
* @param ElggMenuItem $b
* @return bool
*/
- public static function compareByTitle($a, $b) {
- $a = $a->getTitle();
- $b = $b->getTitle();
+ public static function compareByText($a, $b) {
+ $a = $a->getText();
+ $b = $b->getText();
return strnatcmp($a, $b);
}
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index 0de5feddb..0a1b948cc 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -16,7 +16,7 @@ class ElggMenuItem {
/**
* @var string The menu display string
*/
- protected $title;
+ protected $text;
/**
* @var string The menu url
@@ -46,7 +46,7 @@ class ElggMenuItem {
/**
* @var string Tooltip
*/
- protected $tooltip = '';
+ protected $title = '';
/**
* @var int Menu weight - smaller weights float to the top
@@ -77,12 +77,12 @@ class ElggMenuItem {
* ElggMenuItem constructor
*
* @param string $name Identifier of the menu item
- * @param string $title Title of the menu item
+ * @param string $text Display text of the menu item
* @param string $url URL of the menu item
*/
- public function __construct($name, $title, $url) {
+ public function __construct($name, $text, $url) {
$this->name = $name;
- $this->title = $title;
+ $this->text = $text;
if ($url) {
$this->url = elgg_normalize_url($url);
}
@@ -99,13 +99,13 @@ class ElggMenuItem {
* @return ElggMenuItem or NULL on error
*/
public static function factory($options) {
- if (!isset($options['name']) || !isset($options['title'])) {
+ if (!isset($options['name']) || !isset($options['text'])) {
return NULL;
}
- $item = new ElggMenuItem($options['name'], $options['title'], $options['url']);
+ $item = new ElggMenuItem($options['name'], $options['text'], $options['url']);
unset($options['name']);
- unset($options['title']);
+ unset($options['text']);
unset($options['url']);
// special catch in case someone uses context rather than contexts
@@ -136,12 +136,12 @@ class ElggMenuItem {
}
/**
- * Get the display title of the menu
+ * Get the display text of the menu
*
* @return string
*/
- public function getTitle() {
- return $this->title;
+ public function getText() {
+ return $this->text;
}
/**
@@ -229,7 +229,7 @@ class ElggMenuItem {
* @return void
*/
public function setTooltip($text) {
- $this->tooltip = $text;
+ $this->title = $text;
}
/**
@@ -238,7 +238,7 @@ class ElggMenuItem {
* @return string
*/
public function getTooltip() {
- return $this->tooltip;
+ return $this->title;
}
/**
@@ -408,13 +408,16 @@ class ElggMenuItem {
* @return string
*/
public function getLink(array $vars = array()) {
- $vars['text'] = $this->title;
+ $vars['text'] = $this->text;
if ($this->url) {
$vars['href'] = $this->url;
}
if ($this->linkClass) {
$vars['class'] = $this->linkClass;
}
+ if ($this->title) {
+ $vars['title'] = $this->title;
+ }
return elgg_view('output/url', $vars);
}