Version 5.1 - All the GraphQL #32
@ -73,4 +73,39 @@
|
||||
</section>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (count($staff) > 0): ?>
|
||||
<br />
|
||||
<hr />
|
||||
<h2>Staff</h2>
|
||||
|
||||
<?php foreach ($staff as $role => $people): ?>
|
||||
<h3><?= $role ?></h3>
|
||||
<section class='media-wrap flex flex-wrap flex-justify-start'>
|
||||
<?php foreach ($people as $pid => $person): ?>
|
||||
<article class='character person'>
|
||||
<?php $link = $url->generate('person', ['id' => $pid]) ?>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
<?= $person['name'] ?>
|
||||
</a>
|
||||
</div>
|
||||
<a href="<?= $link ?>">
|
||||
<picture>
|
||||
<source
|
||||
srcset="<?= $urlGenerator->assetUrl("images/people/{$pid}.webp") ?>"
|
||||
type="image/webp"
|
||||
>
|
||||
<source
|
||||
srcset="<?= $urlGenerator->assetUrl("images/people/{$pid}.jpg") ?>"
|
||||
type="image/jpeg"
|
||||
>
|
||||
<img src="<?= $urlGenerator->assetUrl("images/people/{$pid}.jpg") ?>" alt="" />
|
||||
</picture>
|
||||
</a>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
</main>
|
@ -16,8 +16,6 @@
|
||||
|
||||
namespace Aviat\AnimeClient\Controller;
|
||||
|
||||
use function Aviat\AnimeClient\getLocalImg;
|
||||
|
||||
use Aviat\AnimeClient\Controller as BaseController;
|
||||
use Aviat\AnimeClient\API\JsonAPI;
|
||||
use Aviat\Ion\ArrayWrapper;
|
||||
|
@ -294,8 +294,6 @@ final class Manga extends Controller {
|
||||
return;
|
||||
}
|
||||
|
||||
// dd($data['included']);
|
||||
|
||||
if (array_key_exists('mediaCharacters', $data['included']))
|
||||
{
|
||||
$mediaCharacters = $data['included']['mediaCharacters'];
|
||||
@ -318,27 +316,25 @@ final class Manga extends Controller {
|
||||
|
||||
if (array_key_exists('mediaStaff', $data['included']))
|
||||
{
|
||||
foreach ($data['included']['mediaStaff'] as $id => $person)
|
||||
foreach ($data['included']['mediaStaff'] as $id => $staffing)
|
||||
{
|
||||
$personDetails = [];
|
||||
foreach ($person['relationships']['person']['people'] as $p)
|
||||
$role = $staffing['attributes']['role'];
|
||||
|
||||
foreach($staffing['relationships']['person']['people'] as $personId => $personDetails)
|
||||
{
|
||||
$personDetails = $p['attributes'];
|
||||
}
|
||||
|
||||
$role = $person['attributes']['role'];
|
||||
|
||||
if ( ! array_key_exists($role, $staff))
|
||||
{
|
||||
$staff[$role] = [];
|
||||
}
|
||||
|
||||
$staff[$role][$id] = [
|
||||
'name' => $personDetails['name'] ?? '??',
|
||||
'image' => $personDetails['image'],
|
||||
$staff[$role][$personId] = [
|
||||
'id' => $personId,
|
||||
'name' => $personDetails['attributes']['name'] ?? '??',
|
||||
'image' => $personDetails['attributes']['image'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty($characters['main']))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user