Add staff section on Manga detail pages
This commit is contained in:
parent
29a4114e8c
commit
be2f7708ad
@ -73,4 +73,39 @@
|
|||||||
</section>
|
</section>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endif ?>
|
<?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>
|
</main>
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Controller;
|
namespace Aviat\AnimeClient\Controller;
|
||||||
|
|
||||||
use function Aviat\AnimeClient\getLocalImg;
|
|
||||||
|
|
||||||
use Aviat\AnimeClient\Controller as BaseController;
|
use Aviat\AnimeClient\Controller as BaseController;
|
||||||
use Aviat\AnimeClient\API\JsonAPI;
|
use Aviat\AnimeClient\API\JsonAPI;
|
||||||
use Aviat\Ion\ArrayWrapper;
|
use Aviat\Ion\ArrayWrapper;
|
||||||
|
@ -294,8 +294,6 @@ final class Manga extends Controller {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($data['included']);
|
|
||||||
|
|
||||||
if (array_key_exists('mediaCharacters', $data['included']))
|
if (array_key_exists('mediaCharacters', $data['included']))
|
||||||
{
|
{
|
||||||
$mediaCharacters = $data['included']['mediaCharacters'];
|
$mediaCharacters = $data['included']['mediaCharacters'];
|
||||||
@ -318,25 +316,23 @@ final class Manga extends Controller {
|
|||||||
|
|
||||||
if (array_key_exists('mediaStaff', $data['included']))
|
if (array_key_exists('mediaStaff', $data['included']))
|
||||||
{
|
{
|
||||||
foreach ($data['included']['mediaStaff'] as $id => $person)
|
foreach ($data['included']['mediaStaff'] as $id => $staffing)
|
||||||
{
|
{
|
||||||
$personDetails = [];
|
$role = $staffing['attributes']['role'];
|
||||||
foreach ($person['relationships']['person']['people'] as $p)
|
|
||||||
|
foreach($staffing['relationships']['person']['people'] as $personId => $personDetails)
|
||||||
{
|
{
|
||||||
$personDetails = $p['attributes'];
|
if ( ! array_key_exists($role, $staff))
|
||||||
|
{
|
||||||
|
$staff[$role] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$staff[$role][$personId] = [
|
||||||
|
'id' => $personId,
|
||||||
|
'name' => $personDetails['attributes']['name'] ?? '??',
|
||||||
|
'image' => $personDetails['attributes']['image'],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$role = $person['attributes']['role'];
|
|
||||||
|
|
||||||
if ( ! array_key_exists($role, $staff))
|
|
||||||
{
|
|
||||||
$staff[$role] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$staff[$role][$id] = [
|
|
||||||
'name' => $personDetails['name'] ?? '??',
|
|
||||||
'image' => $personDetails['image'],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user