4.1 Beta...ish #12

Merged
timw4mail merged 88 commits from develop into master 2018-11-05 13:15:59 -05:00
3 changed files with 49 additions and 20 deletions
Showing only changes of commit bd4cfaafe1 - Show all commits

View File

@ -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>

View File

@ -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;

View File

@ -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'],
];
} }
} }