parent post"; $page->add_block(new Block(null, "This post belongs to a $a.", "main", 5, "ImageHasParent")); } if (bool_escape($image['has_children'])) { $ids = $database->get_col("SELECT id FROM images WHERE parent_id = :iid", ["iid" => $image->id]); $html = "This post has ".(count($ids) > 1 ? "child posts" : "a child post").""; $html .= " (post "; foreach ($ids as $id) { $html .= "#{$id}, "; } $html = rtrim($html, ", ").")."; $page->add_block(new Block(null, $html, "main", 6, "ImageHasChildren")); } } public function get_parent_editor_html(Image $image): HTMLElement { global $user; return SHM_POST_INFO( "Parent", strval($image['parent_id']) ?: "None", !$user->is_anonymous() ? INPUT(["type" => "number", "name" => "tag_edit__parent", "value" => $image['parent_id']]) : null ); } public function get_help_html(): string { return '
Search for posts that have parent/child relationships.
parent=any
Returns posts that have a parent.
parent=none
Returns posts that have no parent.
parent=123
Returns posts that have image 123 set as parent.
child=any
Returns posts that have at least 1 child.
child=none
Returns posts that have no children.