Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Post exporter class.

Copyright: 2019 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 703 lines (29 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: post  - X-Ref

Post exporter class.

__construct(post_entity $post, array $related = [])   X-Ref
Constructor.

param: post_entity $post The post to export
param: array $related List of related data

define_other_properties()   X-Ref
Return the list of additional properties.

return: array

get_other_values(renderer_base $output)   X-Ref
Get the additional values to inject while exporting.

param: renderer_base $output The renderer.
return: array Keys are the property names, values are their values.

define_related()   X-Ref
Returns a list of objects that are related.

return: array

get_format_parameters_for_message()   X-Ref
This method returns the parameters for the post's message to
use with the function \core_external\util::format_text().

return: array

get_message(post_entity $post)   X-Ref
Get the message text from a post.

param: post_entity $post The post
return: string

export_attachments(array $attachments, post_entity $post, renderer_base $output, bool $canexport)   X-Ref
Get the exported attachments for a post.

param: stored_file[] $attachments The list of attachments for the post
param: post_entity $post The post being exported
param: renderer_base $output Renderer base
param: bool $canexport If the user can export the post (relates to portfolios not exporters like this class)
return: array

export_inline_attachments(array $inlineattachments, post_entity $post, renderer_base $output)   X-Ref
Get the exported inline attachments for a post.

param: array $inlineattachments The list of inline attachments for the post
param: post_entity $post The post being exported
param: renderer_base $output Renderer base
return: array

export_tags(array $tags)   X-Ref
Export the list of tags.

param: core_tag_tag[] $tags List of tags to export
return: array

get_author_subheading_html(stdClass $exportedauthor, int $timecreated)   X-Ref
Get the HTML to display as a subheading in a post.

param: stdClass $exportedauthor The exported author object
param: int $timecreated The post time created timestamp if it's to be displayed
return: string

get_start_time(discussion_entity $discussion, post_entity $post)   X-Ref
Get the start time for a post.

param: discussion_entity $discussion entity
param: post_entity $post entity
return: int The start time (timestamp) for a post