Favorites = $component->tabs('user-favorites', $data['favorites'], static function ($items, $type) use ($component, $helper, $url) { $rendered = []; if ($type === 'character') { uasort($items, fn ($a, $b) => $a['names']['canonical'] <=> $b['names']['canonical']); } else { uasort($items, fn ($a, $b) => $a['titles']['canonical'] <=> $b['titles']['canonical']); } foreach ($items as $id => $item) { if ($type === 'character') { $rendered[] = $component->character( $item['names']['canonical'], $url->generate('character', ['slug' => $item['slug']]), $helper->img(Kitsu::getImage($item)) ); } else { $rendered[] = $component->media( array_merge( [$item['titles']['canonical']], Kitsu::getFilteredTitles($item['titles']), ), $url->generate("{$type}.details", ['id' => $item['slug']]), $helper->img(Kitsu::getPosterImage($item), ['width' => 220]), ); } } return implode('', array_map('mb_trim', $rendered)); }, 'content full-width media-wrap') ?>