aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-12-22 08:12:07 -0500
committerCash Costello <cash.costello@gmail.com>2011-12-22 08:12:07 -0500
commite49df853b2cc3a6a9bc2dd527a64951050142eb9 (patch)
tree6f485b560f89331c65fad3993e055a1834b07177 /views/default/navigation
parent5e5b3705a5ca7b66dfe386490c5570af88b49009 (diff)
parentfea599f1653d7206e34ac33c0c0a668cb587bc20 (diff)
downloadelgg-e49df853b2cc3a6a9bc2dd527a64951050142eb9.tar.gz
elgg-e49df853b2cc3a6a9bc2dd527a64951050142eb9.tar.bz2
Merge branch '1.8' after 1.8.2 release
Conflicts: version.php
Diffstat (limited to 'views/default/navigation')
-rw-r--r--views/default/navigation/menu/default.php13
-rw-r--r--views/default/navigation/menu/elements/item.php6
-rw-r--r--views/default/navigation/menu/elements/section.php17
-rw-r--r--views/default/navigation/pagination.php7
4 files changed, 31 insertions, 12 deletions
diff --git a/views/default/navigation/menu/default.php b/views/default/navigation/menu/default.php
index 0fa391433..006deb3ea 100644
--- a/views/default/navigation/menu/default.php
+++ b/views/default/navigation/menu/default.php
@@ -2,15 +2,17 @@
/**
* Default menu
*
- * @uses $vars['name']
- * @uses $vars['menu']
- * @uses $vars['class']
- * @uses $vars['show_section_headers']
+ * @uses $vars['name'] Name of the menu
+ * @uses $vars['menu'] Array of menu items
+ * @uses $vars['class'] Additional CSS class for the menu
+ * @uses $vars['item_class'] Additional CSS class for each menu item
+ * @uses $vars['show_section_headers'] Do we show headers for each section?
*/
// we want css classes to use dashes
$vars['name'] = preg_replace('/[^a-z0-9\-]/i', '-', $vars['name']);
$headers = elgg_extract('show_section_headers', $vars, false);
+$item_class = elgg_extract('item_class', $vars, '');
$class = "elgg-menu elgg-menu-{$vars['name']}";
if (isset($vars['class'])) {
@@ -23,6 +25,7 @@ foreach ($vars['menu'] as $section => $menu_items) {
'class' => "$class elgg-menu-{$vars['name']}-$section",
'section' => $section,
'name' => $vars['name'],
- 'show_section_headers' => $headers
+ 'show_section_headers' => $headers,
+ 'item_class' => $item_class,
));
}
diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php
index 5d6a7e367..22383ce0b 100644
--- a/views/default/navigation/menu/elements/item.php
+++ b/views/default/navigation/menu/elements/item.php
@@ -4,6 +4,9 @@
*
* @package Elgg.Core
* @subpackage Navigation
+ *
+ * @uses $vars['item'] ElggMenuItem
+ * @uses $vars['item_class'] Additional CSS class for the menu item
*/
$item = $vars['item'];
@@ -21,6 +24,9 @@ if ($children) {
}
$item_class = $item->getItemClass();
+if (isset($vars['item_class']) && $vars['item_class']) {
+ $item_class .= ' ' . $vars['item_class'];
+}
echo "<li class=\"$item_class\">";
echo $item->getContent();
diff --git a/views/default/navigation/menu/elements/section.php b/views/default/navigation/menu/elements/section.php
index 92a259776..c0e9ba750 100644
--- a/views/default/navigation/menu/elements/section.php
+++ b/views/default/navigation/menu/elements/section.php
@@ -2,15 +2,17 @@
/**
* Menu group
*
- * @uses $vars['items']
- * @uses $vars['class']
- * @uses $vars['name']
- * @uses $vars['section']
- * @uses $vars['show_section_headers']
+ * @uses $vars['items'] Array of menu items
+ * @uses $vars['class'] Additional CSS class for the section
+ * @uses $vars['name'] Name of the menu
+ * @uses $vars['section'] The section name
+ * @uses $vars['item_class'] Additional CSS class for each menu item
+ * @uses $vars['show_section_headers'] Do we show headers for each section
*/
$headers = elgg_extract('show_section_headers', $vars, false);
$class = elgg_extract('class', $vars, '');
+$item_class = elgg_extract('item_class', $vars, '');
if ($headers) {
$name = elgg_extract('name', $vars);
@@ -20,6 +22,9 @@ if ($headers) {
echo "<ul class=\"$class\">";
foreach ($vars['items'] as $menu_item) {
- echo elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
+ echo elgg_view('navigation/menu/elements/item', array(
+ 'item' => $menu_item,
+ 'item_class' => $item_class,
+ ));
}
echo '</ul>';
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php
index 4df5cf575..ad4689d83 100644
--- a/views/default/navigation/pagination.php
+++ b/views/default/navigation/pagination.php
@@ -25,7 +25,12 @@ if (!$limit = (int) elgg_extract('limit', $vars, 10)) {
$count = (int) elgg_extract('count', $vars, 0);
$offset_key = elgg_extract('offset_key', $vars, 'offset');
-$base_url = elgg_extract('baseurl', $vars, current_page_url());
+// some views pass an empty string for base_url
+if (isset($vars['base_url']) && $vars['base_url']) {
+ $base_url = $vars['base_url'];
+} else {
+ $base_url = current_page_url();
+}
$num_pages = elgg_extract('num_pages', $vars, 10);
$delta = ceil($num_pages / 2);