aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/pages/add.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bookmarks/pages/add.php')
-rw-r--r--mod/bookmarks/pages/add.php45
1 files changed, 22 insertions, 23 deletions
diff --git a/mod/bookmarks/pages/add.php b/mod/bookmarks/pages/add.php
index 17e1e6fa4..5a61c2e96 100644
--- a/mod/bookmarks/pages/add.php
+++ b/mod/bookmarks/pages/add.php
@@ -1,36 +1,35 @@
<?php
-
/**
- * Elgg bookmarks plugin add bookmark page
+ * Add bookmark page
*
* @package ElggBookmarks
*/
gatekeeper();
+$bookmark_guid = get_input('guid');
+$bookmark = get_entity($bookmark_guid);
+$container_guid = (int) get_input('container_guid');
+$container = get_entity($container_guid);
-// Get the current page's owner
-$page_owner = page_owner_entity();
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
+// for groups.
+$page_owner = $container;
+if (elgg_instanceof($container, 'object')) {
+ $page_owner = $container->getContainerEntity();
}
-if ($page_owner instanceof ElggGroup)
- $container = $page_owner->guid;
-$area2 .= elgg_view_title(elgg_echo('bookmarks:this'), false);
+elgg_set_page_owner_guid($page_owner->getGUID());
-// If we've been given a bookmark to edit, grab it
-if ($this_guid = get_input('bookmark',0)) {
- $entity = get_entity($this_guid);
- if ($entity->canEdit()) {
- $area2 .= elgg_view('bookmarks/form',array('entity' => $entity, 'container_guid' => $container));
- }
-} else {
- $area2 .= elgg_view('bookmarks/form', array('container_guid' => $container));
-}
+$title = elgg_echo('bookmarks:add');
+elgg_push_breadcrumb($title);
+
+$vars = bookmarks_prepare_form_vars();
+$content = elgg_view_form('bookmarks/save', array(), $vars);
-// Format page
-$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
+$body = elgg_view_layout('content', array(
+ 'filter' => '',
+ 'buttons' => '',
+ 'content' => $content,
+ 'title' => $title,
+));
-// Draw it
-page_draw(elgg_echo('bookmarks:add'),$body);
+echo elgg_view_page($title, $body); \ No newline at end of file