Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 23 additions and 21 deletions
Showing only changes of commit 50f3c394c5 - Show all commits

View File

@ -11,10 +11,10 @@
<td class="align-right">Airing Status</td>
<td><?= $data['status'] ?></td>
</tr>
<tr>
<?php /* <tr>
<td>Show Type</td>
<td><?= $data['show_type'] ?></td>
</tr>
</tr> */ ?>
<tr>
<td>Episode Count</td>
<td><?= $data['episode_count'] ?? '-' ?></td>
@ -130,7 +130,7 @@
<article class="<?= $role === 'supporting' ? 'small-' : '' ?>character">
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
<div class="name">
<?= $helper->a($link, $char['name']); ?>
<?= $helper->a($link, $char['name']) ?>
</div>
<a href="<?= $link ?>">
<?= $helper->picture("images/characters/{$id}.webp") ?>

View File

@ -41,24 +41,6 @@ query ($slug: String!) {
slug
}
role
voices {
nodes {
id
licensor {
id
name
}
locale
person {
id
names {
alternatives
canonical
localized
}
}
}
}
}
pageInfo {
endCursor

View File

@ -46,6 +46,26 @@ final class AnimeTransformer extends AbstractTransformer {
$title = $base['titles']['canonical'];
$titles = Kitsu::filterLocalizedTitles($base['titles']);
if (count($base['characters']['nodes']) > 0)
{
$characters['main'] = [];
$characters['supporting'] = [];
foreach ($base['characters']['nodes'] as $rawCharacter)
{
$type = $rawCharacter['role'] === 'MAIN' ? 'main' : 'supporting';
$details = $rawCharacter['character'];
$characters[$type][$details['id']] = [
'image' => $details['image'],
'name' => $details['names']['canonical'],
'slug' => $details['slug'],
];
}
uasort($characters['main'], fn($a, $b) => $a['name'] <=> $b['name']);
uasort($characters['supporting'], fn($a, $b) => $a['name'] <=> $b['name']);
}
$data = [
'age_rating' => $base['ageRating'],
'age_rating_guide' => $base['ageRatingGuide'],