diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tidypics.php | 31 | 
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/tidypics.php b/lib/tidypics.php index 8fcfc22c9..7eedb246d 100644 --- a/lib/tidypics.php +++ b/lib/tidypics.php @@ -59,6 +59,37 @@ function tp_get_img_dir() {  	return $file->getFilenameOnFilestore() . 'image/';  } +function tidypics_prepare_form_vars($entity = null) { +	// input names => defaults +	$values = array( +		'title' => '', +		'description' => '', +		'access_id' => ACCESS_DEFAULT, +		'tags' => '', +		'container_guid' => elgg_get_page_owner_guid(), +		'guid' => null, +		'entity' => $entity, +	); + +	if ($entity) { +		foreach (array_keys($values) as $field) { +			if (isset($entity->$field)) { +				$values[$field] = $entity->$field; +			} +		} +	} + +	if (elgg_is_sticky_form('tidypics')) { +		$sticky_values = elgg_get_sticky_values('tidypics'); +		foreach ($sticky_values as $key => $value) { +			$values[$key] = $value; +		} +	} + +	elgg_clear_sticky_form('tidypics'); + +	return $values; +}  /*********************************************************************  | 
