aboutsummaryrefslogtreecommitdiff
path: root/mod/file/lib
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-01 17:55:18 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-01 17:55:18 +0000
commit7b8a18ab7f993aa5f4f7f643478f06a8e3f7ed52 (patch)
tree1070be6b85c5a2327163cb0326dfbcbc62f10d62 /mod/file/lib
parent07ffe6464b453fd90cd2833fc55f804c57c52b4a (diff)
downloadelgg-7b8a18ab7f993aa5f4f7f643478f06a8e3f7ed52.tar.gz
elgg-7b8a18ab7f993aa5f4f7f643478f06a8e3f7ed52.tar.bz2
almost finished updating the file plugin to work with new html/css
git-svn-id: http://code.elgg.org/elgg/trunk@7804 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/file/lib')
-rw-r--r--mod/file/lib/file.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/mod/file/lib/file.php b/mod/file/lib/file.php
new file mode 100644
index 000000000..6ca49e95b
--- /dev/null
+++ b/mod/file/lib/file.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * File helper functions
+ *
+ * @package ElggFile
+ */
+
+/**
+ * Prepare the upload/edit form variables
+ *
+ * @param FilePluginFile $file
+ * @return array
+ */
+function file_prepare_form_vars($file = null) {
+
+ // input names => defaults
+ $values = array(
+ 'title' => '',
+ 'description' => '',
+ 'access_id' => ACCESS_DEFAULT,
+ 'tags' => '',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'guid' => null,
+ 'entity' => $file,
+ );
+
+ if ($file) {
+ foreach (array_keys($values) as $field) {
+ $values[$field] = $file->$field;
+ }
+ }
+
+ if (elgg_is_sticky_form('file')) {
+ foreach (array_keys($values) as $field) {
+ $values[$field] = elgg_get_sticky_value('file', $field);
+ }
+ }
+
+ elgg_clear_sticky_form('file');
+
+ return $values;
+}