aboutsummaryrefslogtreecommitdiff
path: root/mod/thewire
diff options
context:
space:
mode:
Diffstat (limited to 'mod/thewire')
-rw-r--r--mod/thewire/start.php25
-rw-r--r--mod/thewire/views/default/object/thewire.php8
-rw-r--r--mod/thewire/views/default/thewire/metadata.php56
3 files changed, 30 insertions, 59 deletions
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
index 0f51d052e..a9a576904 100644
--- a/mod/thewire/start.php
+++ b/mod/thewire/start.php
@@ -24,6 +24,9 @@ function thewire_init() {
// add a site navigation item
$item = new ElggMenuItem('thewire', elgg_echo('thewire'), 'pg/thewire/all');
elgg_register_menu_item('site', $item);
+
+ // remove entity menu items edit and access because they don't apply here.
+ elgg_register_plugin_hook_handler('prepare', 'menu:entity', 'thewire_remove_entity_menu_items');
// Extend system CSS with our own styles, which are defined in the thewire/css view
elgg_extend_view('css', 'thewire/css');
@@ -354,4 +357,26 @@ function thewire_test($hook, $type, $value, $params) {
global $CONFIG;
$value[] = $CONFIG->pluginspath . 'thewire/tests/regex.php';
return $value;
+}
+
+/**
+ * Removes the access and edit items from the entity menu
+ *
+ * @param type $hook
+ * @param type $type
+ * @param type $value
+ * @param type $params
+ * @return array
+ */
+function thewire_remove_entity_menu_items($hook, $type, $value, $params) {
+ if (elgg_in_context('thewire')) {
+ $menu = elgg_extract('default', $value, array());
+ foreach ($menu as $i => $entry) {
+ $name = $entry->getName();
+ if ($name == 'access' || $name == 'edit') {
+ unset($value['default'][$i]);
+ }
+ }
+ return $value;
+ }
} \ No newline at end of file
diff --git a/mod/thewire/views/default/object/thewire.php b/mod/thewire/views/default/object/thewire.php
index 2baadd30b..b784c5c08 100644
--- a/mod/thewire/views/default/object/thewire.php
+++ b/mod/thewire/views/default/object/thewire.php
@@ -29,9 +29,11 @@ $owner_link = elgg_view('output/url', array(
$author_text = elgg_echo('byline', array($owner_link));
$date = elgg_view_friendly_time($post->time_created);
-$metadata = elgg_view('thewire/metadata', array(
- 'entity' => $post,
- 'handler' => 'thewire',
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $post,
+ 'handler' => 'thewire',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
));
$subtitle = "$author_text $date";
diff --git a/mod/thewire/views/default/thewire/metadata.php b/mod/thewire/views/default/thewire/metadata.php
deleted file mode 100644
index 6d871b05f..000000000
--- a/mod/thewire/views/default/thewire/metadata.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- *
- */
-
-$entity = $vars['entity'];
-$handler = elgg_extract('handler', $vars, '');
-
-?>
-<ul class="elgg-menu elgg-menu-metadata">
-<?php
-if (elgg_is_logged_in()) {
- echo '<li>';
- echo elgg_view('output/url', array(
- 'href' => "pg/thewire/reply/$entity->guid",
- 'text' => elgg_echo('thewire:reply'),
- ));
- echo '</li>';
-}
-
-if ($entity->reply) {
- echo '<li>';
- echo elgg_view('output/url', array(
- 'href' => "pg/thewire/previous/$entity->guid",
- 'text' => elgg_echo('thewire:previous'),
- ));
- echo '</li>';
-}
-
-echo '<li>';
-echo elgg_view('output/url', array(
- 'href' => 'pg/thewire/thread/' . $entity->wire_thread,
- 'text' => elgg_echo('thewire:thread'),
-));
-echo '</li>';
-
-
-// links to delete or edit.
-if ($entity->canEdit() && $handler) {
-
- $delete_url = "action/$handler/delete?guid={$entity->getGUID()}";
- $delete_link = elgg_view('output/confirmlink', array(
- 'href' => $delete_url,
- 'text' => elgg_view_icon('delete'),
- 'title' => elgg_echo('delete'),
- 'confirm' => elgg_echo('deleteconfirm'),
- 'text_encode' => false,
- ));
- echo "<li>$delete_link</li>";
-}
-
-$likes = elgg_view_likes($entity);
-echo "<li>$likes</li>";
-
-?>
-</ul> \ No newline at end of file