✨ Story 4.5: temoignages
This commit is contained in:
@@ -150,4 +150,34 @@ function getToolIcon(string $icon): string
|
||||
];
|
||||
|
||||
return $icons[$icon] ?? '🛠';
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère tous les témoignages
|
||||
*/
|
||||
function getTestimonials(): array
|
||||
{
|
||||
$data = loadJsonData('testimonials.json');
|
||||
return $data['testimonials'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les témoignages mis en avant
|
||||
*/
|
||||
function getFeaturedTestimonials(): array
|
||||
{
|
||||
return array_values(array_filter(getTestimonials(), fn($t) => ($t['featured'] ?? false) === true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le témoignage lié à un projet
|
||||
*/
|
||||
function getTestimonialByProject(string $projectSlug): ?array
|
||||
{
|
||||
foreach (getTestimonials() as $testimonial) {
|
||||
if (($testimonial['project_slug'] ?? '') === $projectSlug) {
|
||||
return $testimonial;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user