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/DestinationShortcode.php +20 -4 3.0.4trunk View file →
@@ -24,9 +24,13 @@
24 24 'show_description' => 'yes',
25 25 'show_image' => 'yes',
26 26 'show_pagination' => 'yes', // Default to show pagination like trip shortcode
27 27 'destination' => '', // Classification IDs, comma-separated
28 - 'hide_empty' => 'yes',
28 + // hide_empty defaults to 'no' to preserve the historical
29 + // behavior (show every destination, even ones with zero
30 + // trips). Operators that prefer the empty-archive defense
31 + // opt in with hide_empty="yes".
32 + 'hide_empty' => 'no',
29 33 'featured_only' => 'no',
30 34 'title' => 'Destination Showcase'
31 35 ]);
32 36 }
@@ -272,12 +276,24 @@
272 276 'best_season' => $best_season
273 277 ];
274 278 }
275 279
276 - // Filter out empty destinations if requested
280 + // Filter out destinations that have no published trips.
281 + //
282 + // See ActivityShortcode for the full rationale — the
283 + // prior implementation only filtered on term-metadata
284 + // emptiness (which never actually fires), so destinations
285 + // with zero trips were rendered with empty trip counts
286 + // and broken archive links. We now drop any destination
287 + // whose trip_count (computed above from
288 + // TripClassificationsTable JOIN TripsTable WHERE
289 + // status=publish) is zero, plus the original sanity
290 + // check on name/slug.
277 291 if ($atts['hide_empty'] === 'yes') {
278 - $destinations = array_filter($destinations, function($destination) {
279 - return !empty($destination['term']->name) && !empty($destination['term']->slug);
292 + $destinations = array_filter($destinations, static function ($destination) {
293 + return (int) ($destination['trip_count'] ?? 0) > 0
294 + && !empty($destination['term']->name)
295 + && !empty($destination['term']->slug);
280 296 });
281 297 }
282 298
283 299 // Filter to show only featured destinations if requested