aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/lib/pages.php
blob: 943383fd70fb60c82e3414f27820d6e238b3ab79 (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
<?php
/**
 * Pages function library
 */

/**
 * Prepare the add/edit form variables
 *
 * @param ElggOobject $page
 * @return array
 */
function pages_prepare_form_vars($page = null) {

	// input names => defaults
	$values = array(
		'title' => '',
		'description' => '',
		'access_id' => ACCESS_DEFAULT,
		'write_access_id' => ACCESS_DEFAULT,
		'tags' => '',
		'container_guid' => elgg_get_page_owner_guid(),
		'guid' => null,
		'entity' => $page,
	);

	if ($page) {
		foreach (array_keys($values) as $field) {
			$values[$field] = $file->$field;
		}
	}

	if (elgg_is_sticky_form('page')) {
		foreach (array_keys($values) as $field) {
			$values[$field] = elgg_get_sticky_value('page', $field);
		}
	}

	elgg_clear_sticky_form('page');

	return $values;
}