MDL-64656 core_tag: Return tags in modules and blog
[moodle.git] / mod / forum / externallib.php
index ba39260..a4d0591 100644 (file)
@@ -419,6 +419,8 @@ class mod_forum_external extends external_api {
             if (!empty($messageinlinefiles)) {
                 $post->messageinlinefiles = $messageinlinefiles;
             }
+            // Post tags.
+            $post->tags = \core_tag\external\util::get_item_tags('mod_forum', 'forum_posts', $post->id);
 
             $posts[] = $post;
         }
@@ -465,6 +467,9 @@ class mod_forum_external extends external_api {
                                 'userpictureurl' => new external_value(PARAM_URL, 'Post author picture.', VALUE_OPTIONAL),
                                 'deleted' => new external_value(PARAM_BOOL, 'This post has been removed.'),
                                 'isprivatereply' => new external_value(PARAM_BOOL, 'The post is a private reply'),
+                                'tags' => new external_multiple_structure(
+                                    \core_tag\external\tag_item_exporter::get_read_structure(), 'Tags', VALUE_OPTIONAL
+                                ),
                             ), 'post'
                         )
                     ),