feat(auth,api): begin work on API input

This commit is contained in:
David Bailey 2024-08-24 15:47:23 +02:00
parent 0dcf36052e
commit c607d57221
11 changed files with 44 additions and 11 deletions

View file

@ -1,4 +1,3 @@
<?php
class Post implements ArrayAccess {
@ -180,7 +179,7 @@ class Post implements ArrayAccess {
}
public function to_array($options = []) {
$out_data = $this->data;
$out_data = array_merge($this->site_defaults, $this->data);
if(isset($options['markdown'])) {
$out_data['markdown'] = $this->get_markdown();
@ -189,7 +188,14 @@ class Post implements ArrayAccess {
$out_data['html'] = $this->get_html();
}
if(isset($options['children'])) {
die();
$children = $this->get_child_posts();
$child_arrays = [];
foreach($children AS $child) {
array_push($child_arrays, $child->to_array());
}
$out_data['children'] = $child_arrays;
}
return $out_data;