blob: 815330e2c52a64246ed30d3bb3beea7da02aae20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?php
/**
* Bookmarks helper functions
*
* @package Bookmarks
*/
/**
* Prepare the add/edit form variables
*
* @param ElggObject $bookmark A bookmark object.
* @return array
*/
function bookmarks_prepare_form_vars($bookmark = null) {
// input names => defaults
$values = array(
'title' => get_input('title', ''),
'address' => get_input('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;
}
|