PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.11
Yatra – Travel Booking & Tour Operator Software v3.0.11
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / app / Core / Handlers / TripPageHandler.php

TripPageHandler.php in Yatra – Travel Booking & Tour Operator Software 3.0.11, at app/Core/Handlers/TripPageHandler.php

60 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\Core\Handlers;
6
7 use Yatra\Controllers\SingleTripController;
8 use Yatra\Core\Assets\TripAssetManager;
9 use Yatra\Services\SettingsService;
10
11 /**
12 * Trip Page Handler
13 *
14 * Handles single trip page requests
15 */
16 class TripPageHandler extends BasePageHandler
17 {
18 /**
19 * Handle trip page request
20 *
21 * @param array $route_data Route data from RouteMatcher
22 * @return bool True if handled successfully
23 */
24 public function handle(array $route_data): bool
25 {
26 $trip_slug = $route_data['slug'];
27 // Use SingleTripController to get prepared trip data
28 $controller = new SingleTripController();
29 $trip_data = $controller->getBySlug($trip_slug);
30
31 if (!$trip_data) {
32 $this->set404();
33 return false;
34 }
35
36 // Set up global trip object for template compatibility
37 global $trip;
38 $trip = $trip_data;
39
40 // Configure $wp_query + virtual WP_Post so FSE block themes resolve the
41 // singular template (not 404.html) and render the site header normally.
42 $this->setupPageEnvironment('singular', [
43 'title' => (string) ($trip->title ?? $trip->name ?? ''),
44 'object_id' => (int) ($trip->id ?? 0),
45 'post_type' => 'page',
46 'post_name' => $trip_slug,
47 ]);
48
49 // Set up query vars for backward compatibility
50 $this->setQueryVars([
51 'yatra_trip_id' => $trip->id,
52 'yatra_trip' => $trip,
53 'yatra_trip_slug' => $trip_slug,
54 'yatra_page' => $route_data['base'] ?? SettingsService::getTripBase(),
55 ]);
56
57 return $this->selectTemplate('single-trip', new TripAssetManager(), 'trip');
58 }
59 }
60