Browse Source

fix slug bug

gitcitadel
Silberengel 2 weeks ago
parent
commit
5d276d1f98
  1. 9
      src/Service/MagazineContentService.php
  2. 2
      src/Service/TopicIndexService.php

9
src/Service/MagazineContentService.php

@ -702,6 +702,7 @@ final class MagazineContentService @@ -702,6 +702,7 @@ final class MagazineContentService
*/
public function collectFeaturedArticleSlugsForHome(array $categoryATags): array
{
$seen = [];
$out = [];
foreach ($categoryATags as $row) {
$coord = $row[1];
@ -711,14 +712,16 @@ final class MagazineContentService @@ -711,14 +712,16 @@ final class MagazineContentService
foreach ($this->buildFeaturedWallBlocksForCategoryTree($coord) as $b) {
foreach ($b['cards'] as $card) {
$s = \trim((string) $card->getSlug());
if ($s !== '') {
$out[$s] = true;
if ($s !== '' && !isset($seen[$s])) {
// Use a list, not slug-keyed map: PHP casts numeric-string keys to int.
$seen[$s] = true;
$out[] = $s;
}
}
}
}
return array_keys($out);
return $out;
}
/**

2
src/Service/TopicIndexService.php

@ -32,7 +32,7 @@ final class TopicIndexService @@ -32,7 +32,7 @@ final class TopicIndexService
);
$featured = [];
foreach ($slugs as $s) {
$s = \strtolower(\trim($s));
$s = \strtolower(\trim((string) $s));
if ($s !== '') {
$featured[$s] = true;
}

Loading…
Cancel
Save