@php // Switched off in Admin -> Pages: the band does not draw, on any layout that includes it. if (!section_on('video-band')) { return; } /** * Full-width video band. Starts playing when it scrolls into view and pauses again * when it leaves, so it never runs off-screen burning bandwidth. Muted + playsinline * because every current browser blocks autoplay that carries sound. * * The single control toggles play/pause; both of its labels are rendered here as data * attributes so the copy stays translated in PHP and js/home.js only swaps between them. * * The clip is served from a live "feature_video" ad campaign (vendor-paid or admin house * ad); either way it carries the same top-left "Sponsored" disclosure. A video creative * renders as the looping band; an image creative — or no campaign at all — falls back to * a still image (the ad's own image, else the theme-options fallback), never a hardcoded clip. */ $ad = active_ad('feature_video'); // This band renders NO headline and NO body — the picture IS the advertisement. So what the // placement is SELLING decides it: the campaign's own upload wins, then the sponsored dish's photo, // then the restaurant cover (AdCampaign::subjectImage). Previously only the upload was consulted, // so a placement with no file of its own showed the theme's generic fallback and sold nothing. $adSubject = $ad ? \App\Models\AdCampaign::subjectImage($ad) : null; $adMedia = $adSubject !== null ? media($adSubject) : ''; $isVideo = (bool) preg_match('/\.(mp4|webm|ogv)(\?|$)/i', $adMedia); /* THIS BAND IS A VIDEO BAND, SO ITS EMPTY STATE IS A VIDEO. With nothing to show, it used to drop to ad_fallback_src() — the generic still used by every other placement — which turned the one moving section on the page into a flat image. The theme already carries a video fallback for exactly this (fallback_about_video), so that is what an empty band shows. An ad that genuinely uploaded a still is left alone: the advertiser chose an image, and replacing it with the theme's clip would show something they did not buy. */ if (!$isVideo && $adMedia === '') { // The SHIPPED clip is the default — the same one BrandingService and the branding form fall // back to. Read with an empty default, a fresh install (no row saved yet) dropped to the still. $fallbackVideo = trim((string) setting('fallback_about_video', 'assets/client/video/video.mp4')); if ($fallbackVideo !== '' && preg_match('/\.(mp4|webm|ogv)$/i', $fallbackVideo)) { $adMedia = media($fallbackVideo); $isVideo = true; } } @endphp
@if ($ad){{ setting('ad_disclosure_label', t_raw('common.sponsored_label')) }}@endif @if ($isVideo) @else @endif @if ($ad) @php $adRest = (string) ($ad['restaurant_name'] ?? ''); @endphp @php // The whole band is a counted click-through to the advertiser, with a branded // "Order now" cursor standing in for the pointer while hovering it. @endphp @endif