PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Services/Template/TemplateMapper.php +71 -13 0.9.1 → 1.5 View file →
@@ -3,13 +3,8 @@
3 3 declare(strict_types=1);
4 4
5 5 namespace IvyForms\Services\Template;
6 6
7 -// phpcs:disable PSR1.Files.SideEffects
8 -if (!defined('ABSPATH')) {
9 - exit; // Exit if accessed directly
10 -}
11 -
12 7 /**
13 8 * Class TemplateMapper
14 9 *
15 10 * Maps template IDs to their corresponding template classes
@@ -36,8 +31,31 @@
36 31 'yoga_class_registration_form' => YogaClassRegistrationFormTemplate::class,
37 32 'cooking_class_registration_form' => CookingClassRegistrationFormTemplate::class,
38 33 'conference_room_booking_form' => ConferenceRoomBookingFormTemplate::class,
39 34 'product_order_form' => ProductOrderFormTemplate::class,
35 + 'b2b_product_order_form' => B2bProductOrderFormTemplate::class,
36 + 'corporate_office_supplies_procurement_form' => CorporateOfficeSuppliesProcurementFormTemplate::class,
37 + 'product_customization_form' => ProductCustomizationFormTemplate::class,
38 + 'technology_innovation_summit_registration_form' => TechnologyInnovationSummitRegistrationFormTemplate::class,
39 + 'healthcare_medical_conference_registration_form' => HealthcareMedicalConferenceRegistrationFormTemplate::class,
40 + 'marketing_growth_leadership_conference_registration_form'
41 + => MarketingGrowthLeadershipConferenceRegistrationFormTemplate::class,
42 + 'financial_services_fintech_leadership_conference_registration_form'
43 + => FinancialServicesFintechLeadershipConferenceRegistrationFormTemplate::class,
44 + 'education_academic_research_conference_registration_form'
45 + => EducationAcademicResearchConferenceRegistrationFormTemplate::class,
46 + 'cybersecurity_data_protection_conference_registration_form'
47 + => CybersecurityDataProtectionConferenceRegistrationFormTemplate::class,
48 + 'technology_conference_event_feedback_form' => TechnologyConferenceEventFeedbackFormTemplate::class,
49 + 'healthcare_seminar_medical_event_feedback_form' => HealthcareSeminarMedicalEventFeedbackFormTemplate::class,
50 + 'marketing_networking_event_feedback_form' => MarketingNetworkingEventFeedbackFormTemplate::class,
51 + 'corporate_employee_training_feedback_form' => CorporateEmployeeTrainingFeedbackFormTemplate::class,
52 + 'technical_skills_workshop_feedback_form' => TechnicalSkillsWorkshopFeedbackFormTemplate::class,
53 + 'online_course_elearning_feedback_form' => OnlineCourseElearningFeedbackFormTemplate::class,
54 + 'medical_specialist_appointment_booking_form' => MedicalSpecialistAppointmentBookingFormTemplate::class,
55 + 'beauty_salon_personal_care_appointment_form' => BeautySalonPersonalCareAppointmentFormTemplate::class,
56 + 'business_consultation_strategy_session_booking_form'
57 + => BusinessConsultationStrategySessionBookingFormTemplate::class,
40 58 'event_registration' => EventRegistrationTemplate::class,
41 59 'event_tshirt_order_form' => EventTShirtOrderFormTemplate::class,
42 60 'custom_tshirt_order_form' => CustomTShirtOrderFormTemplate::class,
43 61 'custom_cake_order_form' => CustomCakeOrderFormTemplate::class,
@@ -127,8 +145,45 @@
127 145 'website_experience_feedback_form' => WebsiteExperienceFeedbackFormTemplate::class,
128 146 'customer_support_feedback_form' => CustomerSupportFeedbackFormTemplate::class,
129 147 'product_feedback_form' => ProductFeedbackFormTemplate::class,
130 148 'project_completion_feedback_form' => ProjectCompletionFeedbackFormTemplate::class,
149 + 'digital_marketing_internship_application_form' => DigitalMarketingInternshipApplicationFormTemplate::class,
150 + 'software_engineering_internship_application_form'
151 + => SoftwareEngineeringInternshipApplicationFormTemplate::class,
152 + 'warehouse_logistics_worker_application_form' => WarehouseLogisticsWorkerApplicationFormTemplate::class,
153 + 'marketing_specialist_job_application_form' => MarketingSpecialistJobApplicationFormTemplate::class,
154 + 'software_developer_job_application_form' => SoftwareDeveloperJobApplicationFormTemplate::class,
155 + 'commercial_rental_application_form' => CommercialRentalApplicationFormTemplate::class,
156 + 'student_housing_application_form' => StudentHousingApplicationFormTemplate::class,
157 + 'rental_application_form' => RentalApplicationFormTemplate::class,
158 + 'technical_contractor_application_form' => TechnicalContractorApplicationFormTemplate::class,
159 + 'creative_contractor_application_form' => CreativeContractorApplicationFormTemplate::class,
160 + 'freelancer_application_form' => FreelancerApplicationFormTemplate::class,
161 + 'remote_internship_application_form' => RemoteInternshipApplicationFormTemplate::class,
162 + 'corporate_internship_application_form' => CorporateInternshipApplicationFormTemplate::class,
163 + 'university_internship_application_form' => UniversityInternshipApplicationFormTemplate::class,
164 + 'skilled_trade_employment_application_form' => SkilledTradeEmploymentApplicationFormTemplate::class,
165 + 'retail_employment_application_form' => RetailEmploymentApplicationFormTemplate::class,
166 + 'corporate_employment_application_form' => CorporateEmploymentApplicationFormTemplate::class,
167 + 'skilled_professional_job_application_form' => SkilledProfessionalJobApplicationFormTemplate::class,
168 + 'entry_level_job_application_form' => EntryLevelJobApplicationFormTemplate::class,
169 + 'general_job_application_form' => GeneralJobApplicationFormTemplate::class,
170 + 'office_space_rental_application_form' => OfficeSpaceRentalApplicationFormTemplate::class,
171 + 'apartment_rental_application_form' => ApartmentRentalApplicationFormTemplate::class,
172 + 'ui_ux_designer_freelancer_application_form' => UiUxDesignerFreelancerApplicationFormTemplate::class,
173 + 'video_editor_freelancer_application_form' => VideoEditorFreelancerApplicationFormTemplate::class,
174 + 'custom_event_tshirt_bulk_order_form' => CustomEventTShirtBulkOrderFormTemplate::class,
175 + 'fashion_brand_custom_apparel_order_form' => FashionBrandCustomApparelOrderFormTemplate::class,
176 + 'sports_team_custom_jersey_tshirt_order_form' => SportsTeamCustomJerseyTShirtOrderFormTemplate::class,
177 + 'facility_maintenance_issue_report_form' => FacilityMaintenanceIssueReportFormTemplate::class,
178 + 'it_support_equipment_maintenance_form' => ItSupportEquipmentMaintenanceFormTemplate::class,
179 + 'property_maintenance_repair_request_form' => PropertyMaintenanceRepairRequestFormTemplate::class,
180 + 'corporate_event_sponsorship_application_form' => CorporateEventSponsorshipApplicationFormTemplate::class,
181 + 'startup_sponsorship_application_form' => StartupSponsorshipApplicationFormTemplate::class,
182 + 'media_influencer_sponsorship_application_form' => MediaInfluencerSponsorshipApplicationFormTemplate::class,
183 + 'business_vendor_onboarding_form' => BusinessVendorOnboardingFormTemplate::class,
184 + 'wholesale_supplier_application_form' => WholesaleSupplierApplicationFormTemplate::class,
185 + 'service_provider_partnership_application_form' => ServiceProviderPartnershipApplicationFormTemplate::class,
131 186 ];
132 187
133 188 /**
134 189 * Get the template map
@@ -156,9 +211,9 @@
156 211
157 212 /**
158 213 * Get template class by template ID
159 214 *
160 - * @param string $templateId
215 + * @param string $templateId
161 216 * @return string|null Template class name or null if not found
162 217 */
163 218 public static function getTemplateClass(string $templateId): ?string
164 219 {
@@ -167,9 +222,9 @@
167 222
168 223 /**
169 224 * Get template data by template ID
170 225 *
171 - * @param string $templateId
226 + * @param string $templateId
172 227 * @return array<string, mixed>|null Template data or null if not found
173 228 */
174 229 public static function getTemplate(string $templateId): ?array
175 230 {
@@ -194,9 +249,9 @@
194 249
195 250 /**
196 251 * Check if template ID exists
197 252 *
198 - * @param string $templateId
253 + * @param string $templateId
199 254 * @return bool
200 255 */
201 256 public static function hasTemplate(string $templateId): bool
202 257 {
@@ -203,13 +258,17 @@
203 258 return self::getTemplateClass($templateId) !== null;
204 259 }
205 260
206 261 /**
207 - * Get all templates as associative array
262 + * Get all templates metadata (without form_data) for listing purposes
208 263 *
264 + * Returns only: id, name, description, category, subcategory, is_pro, screenshot
265 + * This avoids loading heavy form_data (fields, settings) for every template
266 + * when only metadata is needed for browsing/searching.
267 + *
209 268 * @return array<string, array<string, mixed>>
210 269 */
211 - public static function getAllTemplates(): array
270 + public static function getAllTemplateMetas(): array
212 271 {
213 272 $templates = [];
214 273
215 274 foreach ((new TemplateMapper())->getTemplateMap() as $templateId => $templateClass) {
@@ -217,11 +276,10 @@
217 276 if ($templateClass === BlankFormTemplate::class) {
218 277 continue;
219 278 }
220 279
221 - if (class_exists($templateClass)) {
222 - $templateData = $templateClass::getTemplate();
223 - $templates[$templateId] = $templateData;
280 + if (class_exists($templateClass) && method_exists($templateClass, 'getTemplateMeta')) {
281 + $templates[$templateId] = $templateClass::getTemplateMeta();
224 282 }
225 283 }
226 284
227 285 return $templates;