mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-22 02:47:27 +08:00
upload/section add tags
This commit is contained in:
@@ -21,24 +21,29 @@ class SearchBoxResource extends JsonResource
|
||||
'id' => $this->id,
|
||||
'name' => $this->displaySectionName,
|
||||
'categories' => CategoryResource::collection($this->whenLoaded('categories')),
|
||||
'tags' => TagResource::collection($this->whenLoaded('tags')),
|
||||
];
|
||||
$subCategories = [];
|
||||
$lang = get_langfolder_cookie();
|
||||
$fields = array_keys(SearchBox::$taxonomies);
|
||||
if (!empty($searchBox->extra['taxonomy_labels'])) {
|
||||
$fields = array_column($searchBox->extra['taxonomy_labels'], 'torrent_field');
|
||||
}
|
||||
foreach ($fields as $field) {
|
||||
$relationName = "taxonomy_$field";
|
||||
if ($searchBox->relationLoaded($relationName)) {
|
||||
$subCategories[] = [
|
||||
'field' => $field,
|
||||
'label' => $item['display_text'][$lang] ?? (nexus_trans("searchbox.sub_category_{$field}_label") ?: ucfirst($field)),
|
||||
'data' => MediaResource::collection($searchBox->{$relationName}),
|
||||
];
|
||||
if ($searchBox->showsubcat) {
|
||||
$subCategories = [];
|
||||
$lang = get_langfolder_cookie();
|
||||
$fields = array_keys(SearchBox::$taxonomies);
|
||||
if (!empty($searchBox->extra['taxonomy_labels'])) {
|
||||
$fields = array_column($searchBox->extra['taxonomy_labels'], 'torrent_field');
|
||||
}
|
||||
foreach ($fields as $field) {
|
||||
$relationName = "taxonomy_$field";
|
||||
if ($searchBox->relationLoaded($relationName)) {
|
||||
$subCategories[] = [
|
||||
'field' => $field,
|
||||
'label' => $item['display_text'][$lang] ?? (nexus_trans("searchbox.sub_category_{$field}_label") ?: ucfirst($field)),
|
||||
'data' => MediaResource::collection($searchBox->{$relationName}),
|
||||
];
|
||||
}
|
||||
}
|
||||
if (!empty($subCategories)) {
|
||||
$out['sub_categories'] = $subCategories;
|
||||
}
|
||||
}
|
||||
$out['sub_categories'] = $this->when($this->showsubcat, $subCategories);
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user