| @@ -39,8 +39,11 @@ | ||
| 39 | 39 | 'per_page' => 10, |
| 40 | 40 | 'columns' => 3, |
| 41 | 41 | 'title' => 'Our Trips', |
| 42 | 42 | 'show_pagination' => true, |
| 43 | + // Per-instance card layout. 'inherit' = use the site-wide setting. | |
| 44 | + 'card_layout' => 'inherit', | |
| 45 | + 'cardLayout' => '', | |
| 43 | 46 | 'destinationIds' => [], |
| 44 | 47 | 'activityIds' => [], |
| 45 | 48 | 'categoryIds' => [], |
| 46 | 49 | 'difficultyIds' => [], |
| @@ -90,8 +93,12 @@ | ||
| 90 | 93 | 'show_pagination' => true, |
| 91 | 94 | 'activityIds' => [], |
| 92 | 95 | 'activity' => '', |
| 93 | 96 | 'activity_ids' => '', |
| 97 | + 'show_trip_count' => true, | |
| 98 | + 'show_description' => true, | |
| 99 | + 'show_image' => true, | |
| 100 | + 'hide_empty' => false, | |
| 94 | 101 | ]; |
| 95 | 102 | } |
| 96 | 103 | |
| 97 | 104 | /** |
| @@ -107,8 +114,13 @@ | ||
| 107 | 114 | 'show_pagination' => true, |
| 108 | 115 | 'destinationIds' => [], |
| 109 | 116 | 'destination' => '', |
| 110 | 117 | 'destination_ids' => '', |
| 118 | + 'show_trip_count' => true, | |
| 119 | + 'show_description' => true, | |
| 120 | + 'show_image' => true, | |
| 121 | + 'hide_empty' => false, | |
| 122 | + 'featured_only' => false, | |
| 111 | 123 | ]; |
| 112 | 124 | } |
| 113 | 125 | |
| 114 | 126 | /** |
| @@ -125,9 +137,9 @@ | ||
| 125 | 137 | 'category' => '', |
| 126 | 138 | 'show_trip_count' => true, |
| 127 | 139 | 'show_description' => true, |
| 128 | 140 | 'show_image' => true, |
| 129 | - 'hide_empty' => true, | |
| 141 | + 'hide_empty' => false, | |
| 130 | 142 | 'featured_only' => false, |
| 131 | 143 | 'categoryIds' => [], |
| 132 | 144 | 'category_ids' => '', |
| 133 | 145 | ]; |
| @@ -178,8 +190,22 @@ | ||
| 178 | 190 | $atts['title'] = sanitize_text_field((string) ($atts['title'] ?? 'Our Trips')); |
| 179 | 191 | |
| 180 | 192 | $atts['show_pagination'] = self::coerceToBool($atts['show_pagination'] ?? true, true) ? 'yes' : 'no'; |
| 181 | 193 | |
| 194 | + // Card layout override. Accept camelCase (Gutenberg block: cardLayout) | |
| 195 | + // and snake_case (shortcode: card_layout). Unknown/empty/"inherit" keeps | |
| 196 | + // 'inherit' so the template falls back to the site-wide Design setting. | |
| 197 | + $cardLayoutRaw = ''; | |
| 198 | + if (isset($atts['cardLayout']) && is_string($atts['cardLayout']) && $atts['cardLayout'] !== '') { | |
| 199 | + $cardLayoutRaw = $atts['cardLayout']; | |
| 200 | + } elseif (isset($atts['card_layout']) && is_string($atts['card_layout']) && $atts['card_layout'] !== '') { | |
| 201 | + $cardLayoutRaw = $atts['card_layout']; | |
| 202 | + } | |
| 203 | + $cardLayoutRaw = strtolower(trim($cardLayoutRaw)); | |
| 204 | + $atts['card_layout'] = in_array($cardLayoutRaw, ['standard', 'compact_mobile', 'compact_all'], true) | |
| 205 | + ? $cardLayoutRaw | |
| 206 | + : 'inherit'; | |
| 207 | + | |
| 182 | 208 | // Featured Priority (matches admin form: featured | new | limited; "none"/empty = no filter). |
| 183 | 209 | // Accept both snake_case (shortcode) and camelCase (Gutenberg block attribute). |
| 184 | 210 | $featuredPriorityRaw = ''; |
| 185 | 211 | if (isset($atts['featured_priority']) && is_string($atts['featured_priority']) && $atts['featured_priority'] !== '') { |
| @@ -444,8 +470,17 @@ | ||
| 444 | 470 | |
| 445 | 471 | $cols = max(1, min(self::LISTING_COLUMNS_MAX, (int) ($attributes['columns'] ?? 3))); |
| 446 | 472 | |
| 447 | 473 | $showPag = self::coerceToBool($attributes['show_pagination'] ?? true, true); |
| 474 | + // Forward the same visibility / hide-empty toggles the | |
| 475 | + // trip-category block has exposed since v3.0 so all three | |
| 476 | + // taxonomy blocks share one user-facing surface. hide_empty | |
| 477 | + // is what actually skips activities with zero published | |
| 478 | + // trips (see ActivityShortcode::getActivities). | |
| 479 | + $showTripCount = self::coerceToBool($attributes['show_trip_count'] ?? true, true); | |
| 480 | + $showDescription = self::coerceToBool($attributes['show_description'] ?? true, true); | |
| 481 | + $showImage = self::coerceToBool($attributes['show_image'] ?? true, true); | |
| 482 | + $hideEmpty = self::coerceToBool($attributes['hide_empty'] ?? true, true); | |
| 448 | 483 | |
| 449 | 484 | return [ |
| 450 | 485 | 'order' => $order, |
| 451 | 486 | 'per_page' => (string) $perPage, |
| @@ -457,8 +492,12 @@ | ||
| 457 | 492 | 'activityIds', |
| 458 | 493 | 'activity_ids', |
| 459 | 494 | 'activity' |
| 460 | 495 | ), |
| 496 | + 'show_trip_count' => $showTripCount ? 'yes' : 'no', | |
| 497 | + 'show_description' => $showDescription ? 'yes' : 'no', | |
| 498 | + 'show_image' => $showImage ? 'yes' : 'no', | |
| 499 | + 'hide_empty' => $hideEmpty ? 'yes' : 'no', | |
| 461 | 500 | ]; |
| 462 | 501 | } |
| 463 | 502 | |
| 464 | 503 | /** |
| @@ -478,8 +517,16 @@ | ||
| 478 | 517 | |
| 479 | 518 | $cols = max(1, min(self::LISTING_COLUMNS_MAX, (int) ($attributes['columns'] ?? 3))); |
| 480 | 519 | |
| 481 | 520 | $showPag = self::coerceToBool($attributes['show_pagination'] ?? true, true); |
| 521 | + // Forward the visibility + hide_empty + featured_only toggles | |
| 522 | + // so the destination block exposes the same controls the | |
| 523 | + // [yatra_destination] shortcode already accepts. | |
| 524 | + $showTripCount = self::coerceToBool($attributes['show_trip_count'] ?? true, true); | |
| 525 | + $showDescription = self::coerceToBool($attributes['show_description'] ?? true, true); | |
| 526 | + $showImage = self::coerceToBool($attributes['show_image'] ?? true, true); | |
| 527 | + $hideEmpty = self::coerceToBool($attributes['hide_empty'] ?? true, true); | |
| 528 | + $featuredOnly = self::coerceToBool($attributes['featured_only'] ?? false, false); | |
| 482 | 529 | |
| 483 | 530 | return [ |
| 484 | 531 | 'order' => $order, |
| 485 | 532 | 'per_page' => (string) $perPage, |
| @@ -491,8 +538,13 @@ | ||
| 491 | 538 | 'destinationIds', |
| 492 | 539 | 'destination_ids', |
| 493 | 540 | 'destination' |
| 494 | 541 | ), |
| 542 | + 'show_trip_count' => $showTripCount ? 'yes' : 'no', | |
| 543 | + 'show_description' => $showDescription ? 'yes' : 'no', | |
| 544 | + 'show_image' => $showImage ? 'yes' : 'no', | |
| 545 | + 'hide_empty' => $hideEmpty ? 'yes' : 'no', | |
| 546 | + 'featured_only' => $featuredOnly ? 'yes' : 'no', | |
| 495 | 547 | ]; |
| 496 | 548 | } |
| 497 | 549 | |
| 498 | 550 | /** |