aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/lib/pages.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-15 15:04:39 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-01-15 15:04:39 +0000
commite8d148970261207efbe5435e1abcf68c5ed59cc8 (patch)
tree17e3d167941f30dbb22ea4d689227e3a13c06ec2 /mod/pages/lib/pages.php
parent4dc8868b80fdded7931f715b655970a858836b3d (diff)
downloadelgg-e8d148970261207efbe5435e1abcf68c5ed59cc8.tar.gz
elgg-e8d148970261207efbe5435e1abcf68c5ed59cc8.tar.bz2
pages plugin using new layout - still need to get subpages working and navigation
git-svn-id: http://code.elgg.org/elgg/trunk@7885 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/pages/lib/pages.php')
-rw-r--r--mod/pages/lib/pages.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php
new file mode 100644
index 000000000..943383fd7
--- /dev/null
+++ b/mod/pages/lib/pages.php
@@ -0,0 +1,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;
+}