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
yatra / includes / filter-helpers.php

filter-helpers.php in Yatra – Travel Booking & Tour Operator Software trunk, at includes/filter-helpers.php

146 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Yatra Filter Helper Functions
4 *
5 * Convenient wrapper functions for using the FilterService
6 *
7 * @package Yatra
8 */
9
10 // Prevent direct access
11 if (!defined('ABSPATH')) {
12 exit;
13 }
14
15 use Yatra\Services\FilterService;
16
17 /**
18 * Render individual price range filter
19 *
20 * @param array $active_filters Current active filters
21 * @param array $options Filter options
22 * @return string HTML output
23 */
24 function yatra_render_price_filter(array $active_filters = [], array $options = []): string
25 {
26 $filter_service = new FilterService();
27 return $filter_service->renderPriceRangeFilter($active_filters, $options);
28 }
29
30 /**
31 * Render individual difficulty filter
32 *
33 * @param array $active_filters Current active filters
34 * @param array $options Filter options
35 * @return string HTML output
36 */
37 function yatra_render_difficulty_filter(array $active_filters = [], array $options = []): string
38 {
39 $filter_service = new FilterService();
40 return $filter_service->renderDifficultyFilter($active_filters, $options);
41 }
42
43 /**
44 * Render individual rating filter
45 *
46 * @param array $active_filters Current active filters
47 * @param array $options Filter options
48 * @return string HTML output
49 */
50 function yatra_render_rating_filter(array $active_filters = [], array $options = []): string
51 {
52 $filter_service = new FilterService();
53 return $filter_service->renderRatingFilter($active_filters, $options);
54 }
55
56 /**
57 * Render individual categories filter
58 *
59 * @param array $active_filters Current active filters
60 * @param array $options Filter options
61 * @return string HTML output
62 */
63 function yatra_render_categories_filter(array $active_filters = [], array $options = []): string
64 {
65 $filter_service = new FilterService();
66 return $filter_service->renderCategoriesFilter($active_filters, $options);
67 }
68
69 /**
70 * Render individual destinations filter
71 *
72 * @param array $active_filters Current active filters
73 * @param array $options Filter options
74 * @return string HTML output
75 */
76 function yatra_render_destinations_filter(array $active_filters = [], array $options = []): string
77 {
78 $filter_service = new FilterService();
79 return $filter_service->renderDestinationsFilter($active_filters, $options);
80 }
81
82 /**
83 * Render individual activities filter
84 *
85 * @param array $active_filters Current active filters
86 * @param array $options Filter options
87 * @return string HTML output
88 */
89 function yatra_render_activities_filter(array $active_filters = [], array $options = []): string
90 {
91 $filter_service = new FilterService();
92 return $filter_service->renderActivitiesFilter($active_filters, $options);
93 }
94
95 /**
96 * Render complete filter sidebar
97 *
98 * @param array $active_filters Current active filters
99 * @param array $options Filter options and configuration
100 * @return string HTML output
101 */
102 function yatra_render_filter_sidebar(array $active_filters = [], array $options = []): string
103 {
104 $filter_service = new FilterService();
105 return $filter_service->renderFilterSidebar($active_filters, $options);
106 }
107
108 /**
109 * Render custom filter combination
110 *
111 * @param array $filter_types Array of filter types to render
112 * @param array $active_filters Current active filters
113 * @param array $options Filter options
114 * @return string HTML output
115 */
116 function yatra_render_custom_filters(array $filter_types, array $active_filters = [], array $options = []): string
117 {
118 $filter_service = new FilterService();
119 $output = '';
120
121 foreach ($filter_types as $filter_type) {
122 switch ($filter_type) {
123 case 'price_range':
124 $output .= $filter_service->renderPriceRangeFilter($active_filters, $options);
125 break;
126 case 'difficulty':
127 $output .= $filter_service->renderDifficultyFilter($active_filters, $options);
128 break;
129 case 'rating':
130 $output .= $filter_service->renderRatingFilter($active_filters, $options);
131 break;
132 case 'categories':
133 $output .= $filter_service->renderCategoriesFilter($active_filters, $options);
134 break;
135 case 'destinations':
136 $output .= $filter_service->renderDestinationsFilter($active_filters, $options);
137 break;
138 case 'activities':
139 $output .= $filter_service->renderActivitiesFilter($active_filters, $options);
140 break;
141 }
142 }
143
144 return $output;
145 }
146