Permalink
Browse files

deprecate(discussion): Deprecates the elgg:discussion library

Moves the function into start.php

Fixes #8760
  • Loading branch information...
mrclay committed Jul 29, 2015
1 parent eacaee4 commit bf741815e36ac72a95adf290764cddf05bc568ab
@@ -1,43 +1,3 @@
<?php
-/**
- * Discussion function library
- */
-/**
- * Prepare discussion topic form variables
- *
- * @param ElggObject $topic Topic object if editing
- * @return array
- */
-function discussion_prepare_form_vars($topic = NULL) {
- // input names => defaults
- $values = array(
- 'title' => '',
- 'description' => '',
- 'status' => '',
- 'access_id' => ACCESS_DEFAULT,
- 'tags' => '',
- 'container_guid' => elgg_get_page_owner_guid(),
- 'guid' => null,
- 'topic' => $topic,
- );
-
- if ($topic) {
- foreach (array_keys($values) as $field) {
- if (isset($topic->$field)) {
- $values[$field] = $topic->$field;
- }
- }
- }
-
- if (elgg_is_sticky_form('topic')) {
- $sticky_values = elgg_get_sticky_values('topic');
- foreach ($sticky_values as $key => $value) {
- $values[$key] = $value;
- }
- }
-
- elgg_clear_sticky_form('topic');
-
- return $values;
-}
+elgg_deprecated_notice("The library 'elgg:discussion' is unneeded and will be removed.", "2.0");
View
@@ -82,8 +82,6 @@ function discussion_init() {
*/
function discussion_page_handler($page) {
- elgg_load_library('elgg:discussion');
-
if (!isset($page[0])) {
$page[0] = 'all';
}
@@ -581,3 +579,42 @@ function discussion_search_discussion($hook, $type, $value, $params) {
// trigger the 'normal' object search as it can handle the added options
return elgg_trigger_plugin_hook('search', 'object', $params, array());
}
+
+/**
+ * Prepare discussion topic form variables
+ *
+ * @param ElggObject $topic Topic object if editing
+ * @return array
+ */
+function discussion_prepare_form_vars($topic = NULL) {
+ // input names => defaults
+ $values = array(
+ 'title' => '',
+ 'description' => '',
+ 'status' => '',
+ 'access_id' => ACCESS_DEFAULT,
+ 'tags' => '',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'guid' => null,
+ 'topic' => $topic,
+ );
+
+ if ($topic) {
+ foreach (array_keys($values) as $field) {
+ if (isset($topic->$field)) {
+ $values[$field] = $topic->$field;
+ }
+ }
+ }
+
+ if (elgg_is_sticky_form('topic')) {
+ $sticky_values = elgg_get_sticky_values('topic');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
+ }
+ }
+
+ elgg_clear_sticky_form('topic');
+
+ return $values;
+}
@@ -13,7 +13,7 @@
$title = elgg_echo('discussion:addtopic');
-elgg_push_breadcrumb($group->name, "discussion/owner/$group->guid");
+elgg_push_breadcrumb($container->getDisplayName(), "discussion/owner/{$container->guid}");
elgg_push_breadcrumb($title);
$body_vars = discussion_prepare_form_vars();

0 comments on commit bf74181

Please sign in to comment.