@php // Switched off in Admin -> Pages: the hero does not draw. if (!section_on('hero-slider')) { return; } /** * Multi-slide hero carousel for the homepage. * Slide 1 reuses the premium hero (search + trust). Slides 2-3 are promos. * The drag-&-drop teaser that used to sit here now opens /order-builder itself * (partials/sections/hero-order-builder.php), where the real builder follows it. * * @var array $stats platform stats (rating, restaurants) - optional */ $stats = $stats ?? []; $ratingVal = (float) ($stats['rating'] ?? 0); $rating = number_format($ratingVal, 1); $restCount = (int) ($stats['restaurants'] ?? 0); // Optional paid hero-slide ad. When present it becomes an extra slide inserted // just before the final "become a partner" promo, growing the deck 3 -> 4. $heroAd = active_ad('hero_slide'); // Each curated slide is switched on its own in Admin -> Pages, so a deck can lose one slide rather // than only all three. The count, the numbering and which slide starts active all follow what is // left: a hidden slide must not leave a dot that scrolls to nothing. $slideOn = []; foreach (\App\Services\HomeSection::slidesOf('hero-slider') as $sid) { $slideOn[$sid] = \App\Services\HomeSection::slideOn('hero-slider', $sid); } $slideCount = count(array_filter($slideOn)) + ($heroAd ? 1 : 0); if ($slideCount === 0) { return; } $sN = 0; // running position of the slide being drawn $adLabel = e(setting('ad_disclosure_label', t_raw('common.sponsored_label'))); if ($heroAd) { // Campaign upload -> the sponsored dish's photo -> the restaurant cover; the same chain the ad // card and the video band use, so one placement never shows a different subject from another. $adImg = media(\App\Models\AdCampaign::subjectImage($heroAd), 'assets/admin/fallback/general-fallback.png'); // A hero placement may point at a video instead of a still; render it as a muted, // looping, controls-free background clip so it autoplays inline everywhere. $adMediaTag = preg_match('/\.(mp4|webm|ogv)(\?|$)/i', $adImg) // Held back until this slide is the active one (app.js / home.js attach it). An // autoplaying