PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
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 2.0.11 All 82 releases
← All changes | app/Shortcodes/SearchShortcode.php +30 -1 3.0.13trunk View file →
@@ -33,8 +33,9 @@
33 33 'destination' => '',
34 34 'activities' => '',
35 35 'duration' => '',
36 36 'budget' => '',
37 + 'date' => '',
37 38 ]);
38 39
39 40 // [yatra_search] may appear in posts, widgets, builders, FSE templates, or do_shortcode()
40 41 // with no reliable way to detect that before output. Enqueue on every public frontend
@@ -66,8 +67,35 @@
66 67 [],
67 68 $tripSearchCssVer
68 69 );
69 70
71 + // When the date field is enabled, load the same flatpickr library the
72 + // checkout/booking page uses, so the search date field gets the styled
73 + // calendar instead of the browser's native one. Gated on the global
74 + // toggle so the extra CSS/JS only ships where the field is actually
75 + // used; the search JS self-guards on `typeof flatpickr`, so a per-
76 + // placement [yatra_search date="yes"] override still falls back safely
77 + // to the native input when flatpickr is not present. Shared 'yatra-
78 + // flatpickr' handle → WordPress de-dupes if another component enqueues
79 + // it too.
80 + $searchJsDeps = ['jquery'];
81 + if (\Yatra\Services\SettingsService::isEnabled('search_show_date')) {
82 + wp_enqueue_style(
83 + 'yatra-flatpickr',
84 + 'https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css',
85 + [],
86 + YATRA_VERSION
87 + );
88 + wp_enqueue_script(
89 + 'yatra-flatpickr',
90 + 'https://cdn.jsdelivr.net/npm/flatpickr',
91 + [],
92 + YATRA_VERSION,
93 + true
94 + );
95 + $searchJsDeps[] = 'yatra-flatpickr';
96 + }
97 +
70 98 $tripSearchJsPath = YATRA_PLUGIN_PATH . 'assets/js/trip-search-shortcode.js';
71 99 $tripSearchJsVer = is_readable($tripSearchJsPath)
72 100 ? (string) filemtime($tripSearchJsPath)
73 101 : YATRA_VERSION;
@@ -73,9 +101,9 @@
73 101 : YATRA_VERSION;
74 102 wp_enqueue_script(
75 103 'yatra-trip-search-shortcode',
76 104 YATRA_PLUGIN_URL . 'assets/js/trip-search-shortcode.js',
77 - ['jquery'],
105 + $searchJsDeps,
78 106 $tripSearchJsVer,
79 107 true
80 108 );
81 109
@@ -158,7 +186,8 @@
158 186 'destination' => $resolve($atts['destination'] ?? '', 'search_show_destination'),
159 187 'activities' => $resolve($atts['activities'] ?? '', 'search_show_activities'),
160 188 'duration' => $resolve($atts['duration'] ?? '', 'search_show_duration'),
161 189 'budget' => $resolve($atts['budget'] ?? '', 'search_show_budget'),
190 + 'date' => $resolve($atts['date'] ?? '', 'search_show_date'),
162 191 ];
163 192 }
164 193 }