apply review suggestions
This commit is contained in:
parent
0f620da854
commit
2cc53a958e
2 changed files with 8 additions and 18 deletions
|
@ -177,9 +177,7 @@ class Relationships extends Extension
|
||||||
global $database;
|
global $database;
|
||||||
$child_ids = $database->get_col("SELECT id FROM images WHERE parent_id = :pid ", ["pid" => $image_id]);
|
$child_ids = $database->get_col("SELECT id FROM images WHERE parent_id = :pid ", ["pid" => $image_id]);
|
||||||
|
|
||||||
$children = Search::get_images($child_ids);
|
return Search::get_images($child_ids);
|
||||||
|
|
||||||
return $children;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remove_parent(int $imageID): void
|
private function remove_parent(int $imageID): void
|
||||||
|
@ -225,12 +223,12 @@ class Relationships extends Extension
|
||||||
["id" => $image_id, "pid" => $image['parent_id']]
|
["id" => $image_id, "pid" => $image['parent_id']]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($count > 0) {
|
return $count > 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Image[]
|
||||||
|
*/
|
||||||
public static function get_siblings(int $image_id): array
|
public static function get_siblings(int $image_id): array
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
|
|
|
@ -48,7 +48,7 @@ class RelationshipsTheme extends Themelet
|
||||||
$child_thumb_html = "<div class='shm-relationships-child-thumbs'><div class='shm-child-thumbs'>";
|
$child_thumb_html = "<div class='shm-relationships-child-thumbs'><div class='shm-child-thumbs'>";
|
||||||
foreach ($visible_children as $child) {
|
foreach ($visible_children as $child) {
|
||||||
$child_summary_html .= "<a href='".make_link('post/view/'.$child->id)."'>#{$child->id}</a>, ";
|
$child_summary_html .= "<a href='".make_link('post/view/'.$child->id)."'>#{$child->id}</a>, ";
|
||||||
$child_thumb_html .= $this->get_child_thumbnail_html(Image::by_id($child->id));
|
$child_thumb_html .= $this->get_child_thumbnail_html($child);
|
||||||
}
|
}
|
||||||
$child_summary_html = rtrim($child_summary_html, ", ").").";
|
$child_summary_html = rtrim($child_summary_html, ", ").").";
|
||||||
$child_summary_html .= "</span><a href='#' id='relationships-child-toggle' class='shm-relationships-child-toggle'>« hide</a>";
|
$child_summary_html .= "</span><a href='#' id='relationships-child-toggle' class='shm-relationships-child-toggle'>« hide</a>";
|
||||||
|
@ -99,27 +99,19 @@ class RelationshipsTheme extends Themelet
|
||||||
|
|
||||||
private function get_parent_thumbnail_html(Image $image): HTMLElement
|
private function get_parent_thumbnail_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
|
|
||||||
$parent_id = $image['parent_id'];
|
$parent_id = $image['parent_id'];
|
||||||
$parent_image = Image::by_id($parent_id);
|
$parent_image = Image::by_id($parent_id);
|
||||||
|
|
||||||
$html = $this->build_thumb_html($parent_image);
|
return $this->build_thumb_html($parent_image);
|
||||||
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_child_thumbnail_html(Image $image): HTMLElement
|
private function get_child_thumbnail_html(Image $image): HTMLElement
|
||||||
{
|
{
|
||||||
$html = $this->build_thumb_html($image);
|
return $this->build_thumb_html($image);
|
||||||
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_sibling_thumbnail_html(Image $image): string
|
private function get_sibling_thumbnail_html(Image $image): string
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
|
|
||||||
$siblings = Relationships::get_siblings($image->id);
|
$siblings = Relationships::get_siblings($image->id);
|
||||||
$html = "";
|
$html = "";
|
||||||
|
|
||||||
|
|
Reference in a new issue