File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1616
1717namespace qtype_questionpy \local \api ;
1818
19+ use coding_exception ;
20+ use JsonSerializable ;
21+ use qtype_questionpy \local \array_converter \array_converter ;
1922use qtype_questionpy \local \array_converter \attributes \array_element_class ;
2023use qtype_questionpy \local \array_converter \attributes \array_key ;
24+ use qtype_questionpy \local \array_converter \conversion_exception ;
2125use qtype_questionpy \local \files \file_metadata ;
2226
2327/**
2832 * @copyright 2025 TU Berlin, innoCampus {@link https://www.questionpy.org}
2933 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3034 */
31- class wysiwyg_editor_data {
35+ class wysiwyg_editor_data implements JsonSerializable {
3236 /**
3337 * Initialize a new WYSIWYG editor data instance.
3438 *
@@ -47,4 +51,16 @@ public function __construct(
4751 public array $ files = [],
4852 ) {
4953 }
54+
55+ /**
56+ * Specify data which should be serialized to JSON
57+ * @link https://php.net/manual/en/jsonserializable.jsonserialize.php
58+ * @return mixed data which can be serialized by <b>json_encode</b>,
59+ * which is a value of any type other than a resource.
60+ * @throws coding_exception
61+ * @throws conversion_exception
62+ */
63+ public function jsonSerialize (): mixed {
64+ return array_converter::to_array ($ this );
65+ }
5066}
You can’t perform that action at this time.
0 commit comments