aboutsummaryrefslogtreecommitdiff
path: root/mod/pages
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-07 12:15:38 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-07 12:15:38 +0000
commit142aef30294caab47a184393103aa6644131ba19 (patch)
tree495f2308c99f76f2e33bdac26ceff4f0c9ff5496 /mod/pages
parent5991e7a915191a0d7655b51794dfdc1ac05ce5d7 (diff)
downloadelgg-142aef30294caab47a184393103aa6644131ba19.tar.gz
elgg-142aef30294caab47a184393103aa6644131ba19.tar.bz2
Refs #2895 entity menu uses new menu system
git-svn-id: http://code.elgg.org/elgg/trunk@8622 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages')
-rw-r--r--mod/pages/start.php28
-rw-r--r--mod/pages/views/default/object/page_top.php12
2 files changed, 32 insertions, 8 deletions
diff --git a/mod/pages/start.php b/mod/pages/start.php
index 82f3a2ba9..8c2645f05 100644
--- a/mod/pages/start.php
+++ b/mod/pages/start.php
@@ -71,6 +71,9 @@ function pages_init() {
// icon url override
elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'pages_icon_url_override');
+ // entity menu
+ elgg_register_plugin_hook_handler('register', 'menu:entity', 'pages_entity_menu_setup');
+
// register ecml views to parse
elgg_register_plugin_hook_handler('get_views', 'ecml', 'pages_ecml_views_hook');
}
@@ -211,6 +214,31 @@ function pages_owner_block_menu($hook, $type, $return, $params) {
}
/**
+ * Add links/info to entity menu particular to pages plugin
+ */
+function pages_entity_menu_setup($hook, $type, $return, $params) {
+ if (elgg_in_context('widgets')) {
+ return $return;
+ }
+
+ $entity = $params['entity'];
+ $handler = elgg_extract('handler', $params, false);
+ if ($handler != 'pages') {
+ return $return;
+ }
+
+ $options = array(
+ 'name' => 'history',
+ 'text' => elgg_echo('pages:history'),
+ 'href' => "pg/pages/history/$entity->guid",
+ 'priority' => 150,
+ );
+ $return[] = ElggMenuItem::factory($options);
+
+ return $return;
+}
+
+/**
* Returns a more meaningful message
*
* @param unknown_type $hook
diff --git a/mod/pages/views/default/object/page_top.php b/mod/pages/views/default/object/page_top.php
index aca75b625..72d9720ef 100644
--- a/mod/pages/views/default/object/page_top.php
+++ b/mod/pages/views/default/object/page_top.php
@@ -51,15 +51,11 @@ if ($comments_count != 0 && !$revision) {
$comments_link = '';
}
-$history_link = elgg_view('output/url', array(
- 'href' => "pg/pages/history/$page->guid",
- 'text' => elgg_echo('pages:history'),
-));
-
-$metadata = elgg_view('navigation/menu/metadata', array(
- 'entity' => $page,
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
'handler' => 'pages',
- 'links' => array($history_link),
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
));
$subtitle = "$editor_text $categories $comments_link";