diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-16 22:00:32 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-16 22:00:32 +0000 |
commit | e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7 (patch) | |
tree | 06644a4bd5a764c8dda28cec6125ac5ead486e11 /mod/bookmarks/lib | |
parent | 851b6f87d426ff60d21eeafd6d63ff241bb18b82 (diff) | |
download | elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.gz elgg-e45c0d4a62e6bc0f5aa2cd0522987123a9b457c7.tar.bz2 |
Refs #2680. Bookmarks revamp, part 2.
git-svn-id: http://code.elgg.org/elgg/trunk@8264 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/lib')
-rw-r--r-- | mod/bookmarks/lib/bookmarks.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mod/bookmarks/lib/bookmarks.php b/mod/bookmarks/lib/bookmarks.php new file mode 100644 index 000000000..0ac333152 --- /dev/null +++ b/mod/bookmarks/lib/bookmarks.php @@ -0,0 +1,43 @@ +<?php +/** + * Bookmarks helper functions + * + * @package Bookmarks + */ + +/** + * Prepare the upload/edit form variables + * + * @param ElggObject $bookmark A bookmark object. + * @return array + */ +function bookmarks_prepare_form_vars($bookmark = null) { + // input names => defaults + $values = array( + 'title' => '', + 'address' => '', + 'description' => '', + 'access_id' => ACCESS_DEFAULT, + 'tags' => '', + 'shares' => array(), + 'container_guid' => elgg_get_page_owner_guid(), + 'guid' => null, + 'entity' => $bookmark, + ); + + if ($bookmark) { + foreach (array_keys($values) as $field) { + $values[$field] = $bookmark->$field; + } + } + + if (elgg_is_sticky_form('bookmarks')) { + foreach (array_keys($values) as $field) { + $values[$field] = elgg_get_sticky_value('bookmarks', $field); + } + } + + elgg_clear_sticky_form('bookmarks'); + + return $values; +} |