diff --git a/mod/page/classes/content/exporter.php b/mod/page/classes/content/exporter.php new file mode 100644 index 00000000000..55167c713a7 --- /dev/null +++ b/mod/page/classes/content/exporter.php @@ -0,0 +1,67 @@ +. + +/** + * Content export definition. + * + * @package mod_page + * @copyright 2020 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_page\content; + +use core\content\export\exportable_items\exportable_textarea; +use core\content\export\exporters\abstract_mod_exporter; + +/** + * A class which assists a component to export content. + * + * @copyright 2020 Andrew Nicols + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class exporter extends abstract_mod_exporter { + + /** + * Get the exportable items for mod_page. + * + * @param bool $includeuserdata Whether to include user data, in addition to shared content. + * @return \core\content\export\exportable_item[] + */ + public function get_exportables(bool $includeuserdata = false): array { + $contentitems = []; + + $contentitems[] = new exportable_textarea( + $this->get_context(), + $this->get_component(), + get_string('content', 'mod_page'), + + // Content is in the 'content' field of the 'page' table. + $this->get_modname(), + 'content', + + // The record ID in the database is the CMID. + $this->cm->instance, + 'contentformat', + + // The mod_page content has files in 'content/0', and the itemid (0) is present in the URL. + 'content', + 0, + 0 + ); + + return $contentitems; + } +}