findByConfirmationSegment($confirmation_id); if (!$booking) { return false; } // Configure $wp_query + virtual WP_Post so FSE block themes don't fall back to 404.html. $this->setupPageEnvironment('singular', [ 'title' => __('Booking Confirmation', 'yatra'), 'object_id' => (int) ($booking->id ?? 0), 'post_type' => 'page', 'post_name' => $confirmation_id, ]); // Load trip attributes for booking confirmation display if ($booking && !empty($booking->trip_id)) { try { $singleTripController = new \Yatra\Controllers\SingleTripController(); // Use reflection to access private method $reflection = new \ReflectionClass($singleTripController); $method = $reflection->getMethod('getTripAttributes'); $method->setAccessible(true); $attributes = $method->invoke($singleTripController, (int) $booking->trip_id); // Create a simple list of attribute names for tag display $booking->trip_attributes_list = array_map(function($attr) { return $attr['name']; }, $attributes); } catch (\Throwable $e) { $booking->trip_attributes_list = []; } } // Set up global booking object $this->setGlobal('yatra_booking', $booking); // Set up query vars for backward compatibility $this->setQueryVars([ 'yatra_booking_confirmation' => $confirmation_id, 'yatra_booking' => $booking, ]); return $this->selectTemplate('booking-confirmation', null, 'booking-confirmation'); } }