From 4f11c2c3121f556968ddbb46d08704fd4286e9ad Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Wed, 26 Nov 2025 20:18:55 -0600 Subject: [PATCH] refactor(admin): Migrate AdminAjaxHandler to Clean Architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move AdminAjaxHandler to Admin/Shared/Infrastructure/Api/Wordpress/ - Create FieldMapperInterface for decentralized field mapping - Create FieldMapperRegistry for module discovery - Create FieldMapperProvider for auto-registration of 12 mappers - Add FieldMappers for all components: - ContactFormFieldMapper (46 fields) - CtaBoxSidebarFieldMapper (32 fields) - CtaLetsTalkFieldMapper - CtaPostFieldMapper - FeaturedImageFieldMapper (15 fields) - FooterFieldMapper (31 fields) - HeroFieldMapper - NavbarFieldMapper - RelatedPostFieldMapper (34 fields) - SocialShareFieldMapper - TableOfContentsFieldMapper - TopNotificationBarFieldMapper (17 fields) - Update functions.php bootstrap with FieldMapperProvider - AdminAjaxHandler reduced from ~700 to 145 lines - Follows SRP, OCP, DIP principles BACKUP BEFORE: Removing CTA A/B Testing legacy system 馃 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../FieldMapping/ContactFormFieldMapper.php | 98 +++ .../FieldMapping/CtaBoxSidebarFieldMapper.php | 76 ++ .../FieldMapping/CtaLetsTalkFieldMapper.php | 68 ++ .../FieldMapping/CtaPostFieldMapper.php | 69 ++ .../FieldMapping/FeaturedImageFieldMapper.php | 48 ++ .../FieldMapping/FooterFieldMapper.php | 75 ++ .../FieldMapping/HeroFieldMapper.php | 65 ++ .../Api/Wordpress/AdminAjaxHandler.php | 699 ------------------ .../FieldMapping/NavbarFieldMapper.php | 78 ++ .../FieldMapping/RelatedPostFieldMapper.php | 77 ++ .../Domain/Contracts/FieldMapperInterface.php | 38 + .../Api/Wordpress/AdminAjaxHandler.php | 145 ++++ .../FieldMapping/FieldMapperProvider.php | 68 ++ .../FieldMapping/FieldMapperRegistry.php | 65 ++ .../FieldMapping/SocialShareFieldMapper.php | 81 ++ .../TableOfContentsFieldMapper.php | 85 +++ .../TopNotificationBarFieldMapper.php | 51 ++ functions.php | 12 +- schemas/contact-form.json | 4 +- 19 files changed, 1199 insertions(+), 703 deletions(-) create mode 100644 Admin/ContactForm/Infrastructure/FieldMapping/ContactFormFieldMapper.php create mode 100644 Admin/CtaBoxSidebar/Infrastructure/FieldMapping/CtaBoxSidebarFieldMapper.php create mode 100644 Admin/CtaLetsTalk/Infrastructure/FieldMapping/CtaLetsTalkFieldMapper.php create mode 100644 Admin/CtaPost/Infrastructure/FieldMapping/CtaPostFieldMapper.php create mode 100644 Admin/FeaturedImage/Infrastructure/FieldMapping/FeaturedImageFieldMapper.php create mode 100644 Admin/Footer/Infrastructure/FieldMapping/FooterFieldMapper.php create mode 100644 Admin/Hero/Infrastructure/FieldMapping/HeroFieldMapper.php delete mode 100644 Admin/Infrastructure/Api/Wordpress/AdminAjaxHandler.php create mode 100644 Admin/Navbar/Infrastructure/FieldMapping/NavbarFieldMapper.php create mode 100644 Admin/RelatedPost/Infrastructure/FieldMapping/RelatedPostFieldMapper.php create mode 100644 Admin/Shared/Domain/Contracts/FieldMapperInterface.php create mode 100644 Admin/Shared/Infrastructure/Api/Wordpress/AdminAjaxHandler.php create mode 100644 Admin/Shared/Infrastructure/FieldMapping/FieldMapperProvider.php create mode 100644 Admin/Shared/Infrastructure/FieldMapping/FieldMapperRegistry.php create mode 100644 Admin/SocialShare/Infrastructure/FieldMapping/SocialShareFieldMapper.php create mode 100644 Admin/TableOfContents/Infrastructure/FieldMapping/TableOfContentsFieldMapper.php create mode 100644 Admin/TopNotificationBar/Infrastructure/FieldMapping/TopNotificationBarFieldMapper.php diff --git a/Admin/ContactForm/Infrastructure/FieldMapping/ContactFormFieldMapper.php b/Admin/ContactForm/Infrastructure/FieldMapping/ContactFormFieldMapper.php new file mode 100644 index 00000000..552d8c87 --- /dev/null +++ b/Admin/ContactForm/Infrastructure/FieldMapping/ContactFormFieldMapper.php @@ -0,0 +1,98 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'contactFormShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'contactFormShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'contactFormShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'contactFormSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'], + 'contactFormSectionDescription' => ['group' => 'content', 'attribute' => 'section_description'], + 'contactFormSubmitButtonText' => ['group' => 'content', 'attribute' => 'submit_button_text'], + 'contactFormSubmitButtonIcon' => ['group' => 'content', 'attribute' => 'submit_button_icon'], + + // Contact Info + 'contactFormShowContactInfo' => ['group' => 'contact_info', 'attribute' => 'show_contact_info'], + 'contactFormPhoneLabel' => ['group' => 'contact_info', 'attribute' => 'phone_label'], + 'contactFormPhoneValue' => ['group' => 'contact_info', 'attribute' => 'phone_value'], + 'contactFormEmailLabel' => ['group' => 'contact_info', 'attribute' => 'email_label'], + 'contactFormEmailValue' => ['group' => 'contact_info', 'attribute' => 'email_value'], + 'contactFormLocationLabel' => ['group' => 'contact_info', 'attribute' => 'location_label'], + 'contactFormLocationValue' => ['group' => 'contact_info', 'attribute' => 'location_value'], + + // Form Labels + 'contactFormFullnamePlaceholder' => ['group' => 'form_labels', 'attribute' => 'fullname_placeholder'], + 'contactFormCompanyPlaceholder' => ['group' => 'form_labels', 'attribute' => 'company_placeholder'], + 'contactFormWhatsappPlaceholder' => ['group' => 'form_labels', 'attribute' => 'whatsapp_placeholder'], + 'contactFormEmailPlaceholder' => ['group' => 'form_labels', 'attribute' => 'email_placeholder'], + 'contactFormMessagePlaceholder' => ['group' => 'form_labels', 'attribute' => 'message_placeholder'], + + // Integration + 'contactFormWebhookUrl' => ['group' => 'integration', 'attribute' => 'webhook_url'], + 'contactFormWebhookMethod' => ['group' => 'integration', 'attribute' => 'webhook_method'], + 'contactFormIncludePageUrl' => ['group' => 'integration', 'attribute' => 'include_page_url'], + 'contactFormIncludeTimestamp' => ['group' => 'integration', 'attribute' => 'include_timestamp'], + + // Messages + 'contactFormSuccessMessage' => ['group' => 'messages', 'attribute' => 'success_message'], + 'contactFormErrorMessage' => ['group' => 'messages', 'attribute' => 'error_message'], + 'contactFormSendingMessage' => ['group' => 'messages', 'attribute' => 'sending_message'], + 'contactFormValidationRequired' => ['group' => 'messages', 'attribute' => 'validation_required'], + 'contactFormValidationEmail' => ['group' => 'messages', 'attribute' => 'validation_email'], + + // Colors + 'contactFormSectionBgColor' => ['group' => 'colors', 'attribute' => 'section_bg_color'], + 'contactFormTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], + 'contactFormDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'], + 'contactFormIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'], + 'contactFormInfoLabelColor' => ['group' => 'colors', 'attribute' => 'info_label_color'], + 'contactFormInfoValueColor' => ['group' => 'colors', 'attribute' => 'info_value_color'], + 'contactFormInputBorderColor' => ['group' => 'colors', 'attribute' => 'input_border_color'], + 'contactFormInputFocusBorder' => ['group' => 'colors', 'attribute' => 'input_focus_border'], + 'contactFormButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'], + 'contactFormButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], + 'contactFormButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'], + 'contactFormSuccessBgColor' => ['group' => 'colors', 'attribute' => 'success_bg_color'], + 'contactFormSuccessTextColor' => ['group' => 'colors', 'attribute' => 'success_text_color'], + 'contactFormErrorBgColor' => ['group' => 'colors', 'attribute' => 'error_bg_color'], + 'contactFormErrorTextColor' => ['group' => 'colors', 'attribute' => 'error_text_color'], + + // Spacing + 'contactFormSectionPaddingY' => ['group' => 'spacing', 'attribute' => 'section_padding_y'], + 'contactFormSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'], + 'contactFormTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], + 'contactFormDescriptionMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'], + 'contactFormFormGap' => ['group' => 'spacing', 'attribute' => 'form_gap'], + + // Visual Effects + 'contactFormInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'], + 'contactFormButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], + 'contactFormButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'], + 'contactFormTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + 'contactFormTextareaRows' => ['group' => 'visual_effects', 'attribute' => 'textarea_rows'], + ]; + } +} diff --git a/Admin/CtaBoxSidebar/Infrastructure/FieldMapping/CtaBoxSidebarFieldMapper.php b/Admin/CtaBoxSidebar/Infrastructure/FieldMapping/CtaBoxSidebarFieldMapper.php new file mode 100644 index 00000000..1a594c73 --- /dev/null +++ b/Admin/CtaBoxSidebar/Infrastructure/FieldMapping/CtaBoxSidebarFieldMapper.php @@ -0,0 +1,76 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'ctaShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'ctaShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'ctaShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'ctaTitle' => ['group' => 'content', 'attribute' => 'title'], + 'ctaDescription' => ['group' => 'content', 'attribute' => 'description'], + 'ctaButtonText' => ['group' => 'content', 'attribute' => 'button_text'], + 'ctaButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'], + 'ctaButtonAction' => ['group' => 'content', 'attribute' => 'button_action'], + 'ctaButtonLink' => ['group' => 'content', 'attribute' => 'button_link'], + + // Behavior + 'ctaTextAlign' => ['group' => 'behavior', 'attribute' => 'text_align'], + + // Typography + 'ctaTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], + 'ctaTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], + 'ctaDescFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'], + 'ctaButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'], + 'ctaButtonFontWeight' => ['group' => 'typography', 'attribute' => 'button_font_weight'], + + // Colors + 'ctaBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'], + 'ctaTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], + 'ctaDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'], + 'ctaButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_background_color'], + 'ctaButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], + 'ctaButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_background'], + 'ctaButtonHoverText' => ['group' => 'colors', 'attribute' => 'button_hover_text_color'], + + // Spacing + 'ctaContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'], + 'ctaTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], + 'ctaDescMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'], + 'ctaButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'], + 'ctaIconMarginRight' => ['group' => 'spacing', 'attribute' => 'icon_margin_right'], + + // Visual Effects + 'ctaBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], + 'ctaButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], + 'ctaBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], + 'ctaTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + ]; + } +} diff --git a/Admin/CtaLetsTalk/Infrastructure/FieldMapping/CtaLetsTalkFieldMapper.php b/Admin/CtaLetsTalk/Infrastructure/FieldMapping/CtaLetsTalkFieldMapper.php new file mode 100644 index 00000000..0249355e --- /dev/null +++ b/Admin/CtaLetsTalk/Infrastructure/FieldMapping/CtaLetsTalkFieldMapper.php @@ -0,0 +1,68 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'ctaLetsTalkShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'ctaLetsTalkShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'ctaLetsTalkShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'ctaLetsTalkButtonText' => ['group' => 'content', 'attribute' => 'button_text'], + 'ctaLetsTalkShowIcon' => ['group' => 'content', 'attribute' => 'show_icon'], + 'ctaLetsTalkIconClass' => ['group' => 'content', 'attribute' => 'icon_class'], + 'ctaLetsTalkModalTarget' => ['group' => 'content', 'attribute' => 'modal_target'], + 'ctaLetsTalkAriaLabel' => ['group' => 'content', 'attribute' => 'aria_label'], + + // Behavior + 'ctaLetsTalkEnableModal' => ['group' => 'behavior', 'attribute' => 'enable_modal'], + 'ctaLetsTalkCustomUrl' => ['group' => 'behavior', 'attribute' => 'custom_url'], + 'ctaLetsTalkOpenNewTab' => ['group' => 'behavior', 'attribute' => 'open_in_new_tab'], + + // Typography + 'ctaLetsTalkFontSize' => ['group' => 'typography', 'attribute' => 'font_size'], + 'ctaLetsTalkFontWeight' => ['group' => 'typography', 'attribute' => 'font_weight'], + 'ctaLetsTalkTextTransform' => ['group' => 'typography', 'attribute' => 'text_transform'], + + // Colors + 'ctaLetsTalkBgColor' => ['group' => 'colors', 'attribute' => 'background_color'], + 'ctaLetsTalkBgHoverColor' => ['group' => 'colors', 'attribute' => 'background_hover_color'], + 'ctaLetsTalkTextColor' => ['group' => 'colors', 'attribute' => 'text_color'], + 'ctaLetsTalkTextHoverColor' => ['group' => 'colors', 'attribute' => 'text_hover_color'], + 'ctaLetsTalkBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'], + + // Spacing + 'ctaLetsTalkPaddingTB' => ['group' => 'spacing', 'attribute' => 'padding_top_bottom'], + 'ctaLetsTalkPaddingLR' => ['group' => 'spacing', 'attribute' => 'padding_left_right'], + 'ctaLetsTalkMarginLeft' => ['group' => 'spacing', 'attribute' => 'margin_left'], + 'ctaLetsTalkIconSpacing' => ['group' => 'spacing', 'attribute' => 'icon_spacing'], + + // Visual Effects + 'ctaLetsTalkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], + 'ctaLetsTalkBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'], + 'ctaLetsTalkBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], + 'ctaLetsTalkTransition' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + ]; + } +} diff --git a/Admin/CtaPost/Infrastructure/FieldMapping/CtaPostFieldMapper.php b/Admin/CtaPost/Infrastructure/FieldMapping/CtaPostFieldMapper.php new file mode 100644 index 00000000..332e97b6 --- /dev/null +++ b/Admin/CtaPost/Infrastructure/FieldMapping/CtaPostFieldMapper.php @@ -0,0 +1,69 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'ctaPostShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'ctaPostShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'ctaPostShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'ctaPostTitle' => ['group' => 'content', 'attribute' => 'title'], + 'ctaPostDescription' => ['group' => 'content', 'attribute' => 'description'], + 'ctaPostButtonText' => ['group' => 'content', 'attribute' => 'button_text'], + 'ctaPostButtonUrl' => ['group' => 'content', 'attribute' => 'button_url'], + 'ctaPostButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'], + + // Typography + 'ctaPostTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], + 'ctaPostTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], + 'ctaPostDescriptionFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'], + 'ctaPostButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'], + + // Colors + 'ctaPostGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'], + 'ctaPostGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'], + 'ctaPostTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], + 'ctaPostDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'], + 'ctaPostButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'], + 'ctaPostButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], + 'ctaPostButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'], + + // Spacing + 'ctaPostContainerMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'], + 'ctaPostContainerMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'], + 'ctaPostContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'], + 'ctaPostTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], + 'ctaPostButtonIconMargin' => ['group' => 'spacing', 'attribute' => 'button_icon_margin'], + + // Visual Effects + 'ctaPostBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], + 'ctaPostGradientAngle' => ['group' => 'visual_effects', 'attribute' => 'gradient_angle'], + 'ctaPostButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], + 'ctaPostButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'], + 'ctaPostTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + 'ctaPostBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], + ]; + } +} diff --git a/Admin/FeaturedImage/Infrastructure/FieldMapping/FeaturedImageFieldMapper.php b/Admin/FeaturedImage/Infrastructure/FieldMapping/FeaturedImageFieldMapper.php new file mode 100644 index 00000000..a1d51e0b --- /dev/null +++ b/Admin/FeaturedImage/Infrastructure/FieldMapping/FeaturedImageFieldMapper.php @@ -0,0 +1,48 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'featuredImageShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'featuredImageShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'featuredImageShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'featuredImageSize' => ['group' => 'content', 'attribute' => 'image_size'], + 'featuredImageLazyLoading' => ['group' => 'content', 'attribute' => 'lazy_loading'], + 'featuredImageLinkToMedia' => ['group' => 'content', 'attribute' => 'link_to_media'], + + // Spacing + 'featuredImageMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'], + 'featuredImageMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'], + + // Visual Effects + 'featuredImageBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], + 'featuredImageBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], + 'featuredImageHoverEffect' => ['group' => 'visual_effects', 'attribute' => 'hover_effect'], + 'featuredImageHoverScale' => ['group' => 'visual_effects', 'attribute' => 'hover_scale'], + 'featuredImageTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + ]; + } +} diff --git a/Admin/Footer/Infrastructure/FieldMapping/FooterFieldMapper.php b/Admin/Footer/Infrastructure/FieldMapping/FooterFieldMapper.php new file mode 100644 index 00000000..5e7bb3d5 --- /dev/null +++ b/Admin/Footer/Infrastructure/FieldMapping/FooterFieldMapper.php @@ -0,0 +1,75 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'footerShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'footerShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + + // Widget 1 + 'footerWidget1Visible' => ['group' => 'widget_1', 'attribute' => 'widget_1_visible'], + 'footerWidget1Title' => ['group' => 'widget_1', 'attribute' => 'widget_1_title'], + + // Widget 2 + 'footerWidget2Visible' => ['group' => 'widget_2', 'attribute' => 'widget_2_visible'], + 'footerWidget2Title' => ['group' => 'widget_2', 'attribute' => 'widget_2_title'], + + // Widget 3 + 'footerWidget3Visible' => ['group' => 'widget_3', 'attribute' => 'widget_3_visible'], + 'footerWidget3Title' => ['group' => 'widget_3', 'attribute' => 'widget_3_title'], + + // Newsletter + 'footerNewsletterVisible' => ['group' => 'newsletter', 'attribute' => 'newsletter_visible'], + 'footerNewsletterTitle' => ['group' => 'newsletter', 'attribute' => 'newsletter_title'], + 'footerNewsletterDescription' => ['group' => 'newsletter', 'attribute' => 'newsletter_description'], + 'footerNewsletterPlaceholder' => ['group' => 'newsletter', 'attribute' => 'newsletter_email_placeholder'], + 'footerNewsletterButtonText' => ['group' => 'newsletter', 'attribute' => 'newsletter_button_text'], + 'footerNewsletterWebhookUrl' => ['group' => 'newsletter', 'attribute' => 'newsletter_webhook_url'], + 'footerNewsletterSuccessMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_success_message'], + 'footerNewsletterErrorMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_error_message'], + + // Footer Bottom + 'footerCopyrightText' => ['group' => 'footer_bottom', 'attribute' => 'copyright_text'], + + // Colors + 'footerBgColor' => ['group' => 'colors', 'attribute' => 'bg_color'], + 'footerTextColor' => ['group' => 'colors', 'attribute' => 'text_color'], + 'footerTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], + 'footerLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'], + 'footerLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'], + 'footerButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'], + 'footerButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], + 'footerButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'], + + // Spacing + 'footerPaddingY' => ['group' => 'spacing', 'attribute' => 'padding_y'], + 'footerMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'], + + // Visual Effects + 'footerInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'], + 'footerButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], + 'footerTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + ]; + } +} diff --git a/Admin/Hero/Infrastructure/FieldMapping/HeroFieldMapper.php b/Admin/Hero/Infrastructure/FieldMapping/HeroFieldMapper.php new file mode 100644 index 00000000..56b55922 --- /dev/null +++ b/Admin/Hero/Infrastructure/FieldMapping/HeroFieldMapper.php @@ -0,0 +1,65 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'heroShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'heroShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'heroShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'heroShowCategories' => ['group' => 'content', 'attribute' => 'show_categories'], + 'heroShowBadgeIcon' => ['group' => 'content', 'attribute' => 'show_badge_icon'], + 'heroBadgeIconClass' => ['group' => 'content', 'attribute' => 'badge_icon_class'], + 'heroTitleTag' => ['group' => 'content', 'attribute' => 'title_tag'], + + // Colors + 'heroGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'], + 'heroGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'], + 'heroTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], + 'heroBadgeBgColor' => ['group' => 'colors', 'attribute' => 'badge_bg_color'], + 'heroBadgeTextColor' => ['group' => 'colors', 'attribute' => 'badge_text_color'], + 'heroBadgeIconColor' => ['group' => 'colors', 'attribute' => 'badge_icon_color'], + 'heroBadgeHoverBg' => ['group' => 'colors', 'attribute' => 'badge_hover_bg'], + + // Typography + 'heroTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], + 'heroTitleFontSizeMobile' => ['group' => 'typography', 'attribute' => 'title_font_size_mobile'], + 'heroTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], + 'heroTitleLineHeight' => ['group' => 'typography', 'attribute' => 'title_line_height'], + 'heroBadgeFontSize' => ['group' => 'typography', 'attribute' => 'badge_font_size'], + + // Spacing + 'heroPaddingVertical' => ['group' => 'spacing', 'attribute' => 'padding_vertical'], + 'heroMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'], + 'heroBadgePadding' => ['group' => 'spacing', 'attribute' => 'badge_padding'], + 'heroBadgeBorderRadius' => ['group' => 'spacing', 'attribute' => 'badge_border_radius'], + + // Visual Effects + 'heroBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], + 'heroTitleTextShadow' => ['group' => 'visual_effects', 'attribute' => 'title_text_shadow'], + 'heroBadgeBackdropBlur' => ['group' => 'visual_effects', 'attribute' => 'badge_backdrop_blur'], + ]; + } +} diff --git a/Admin/Infrastructure/Api/Wordpress/AdminAjaxHandler.php b/Admin/Infrastructure/Api/Wordpress/AdminAjaxHandler.php deleted file mode 100644 index d2292fd9..00000000 --- a/Admin/Infrastructure/Api/Wordpress/AdminAjaxHandler.php +++ /dev/null @@ -1,699 +0,0 @@ - 'No tienes permisos para realizar esta acci贸n.' - ]); - } - - // Obtener datos - $component = sanitize_text_field($_POST['component'] ?? ''); - $settings = json_decode(stripslashes($_POST['settings'] ?? '{}'), true); - - if (empty($component) || empty($settings)) { - wp_send_json_error([ - 'message' => 'Datos incompletos.' - ]); - } - - // Mapear IDs de campos a nombres de atributos del schema - $fieldMapping = $this->getFieldMapping(); - $mappedSettings = []; - - foreach ($settings as $fieldId => $value) { - // Convertir ID del campo a nombre del atributo - if (!isset($fieldMapping[$fieldId])) { - continue; // Campo no mapeado, ignorar - } - - $mapping = $fieldMapping[$fieldId]; - $groupName = $mapping['group']; - $attributeName = $mapping['attribute']; - - if (!isset($mappedSettings[$groupName])) { - $mappedSettings[$groupName] = []; - } - - $mappedSettings[$groupName][$attributeName] = $value; - } - - // Usar Use Case para guardar - if ($this->saveComponentSettingsUseCase !== null) { - $updated = $this->saveComponentSettingsUseCase->execute($component, $mappedSettings); - - wp_send_json_success([ - 'message' => sprintf('Se guardaron %d campos correctamente.', $updated) - ]); - } else { - wp_send_json_error([ - 'message' => 'Error: Use Case no disponible.' - ]); - } - } - - /** - * Restaura los valores por defecto de un componente - */ - public function resetComponentDefaults(): void - { - // Verificar nonce - check_ajax_referer('roi_admin_dashboard', 'nonce'); - - // Verificar permisos - if (!current_user_can('manage_options')) { - wp_send_json_error([ - 'message' => 'No tienes permisos para realizar esta acci贸n.' - ]); - } - - // Obtener componente - $component = sanitize_text_field($_POST['component'] ?? ''); - - if (empty($component)) { - wp_send_json_error([ - 'message' => 'Componente no especificado.' - ]); - } - - // Ruta al schema JSON - $schemaPath = get_template_directory() . '/Schemas/' . $component . '.json'; - - if (!file_exists($schemaPath)) { - wp_send_json_error([ - 'message' => 'Schema del componente no encontrado.' - ]); - } - - // Usar repositorio para restaurar valores - if ($this->saveComponentSettingsUseCase !== null) { - global $wpdb; - $repository = new \ROITheme\Shared\Infrastructure\Persistence\Wordpress\WordPressComponentSettingsRepository($wpdb); - $updated = $repository->resetToDefaults($component, $schemaPath); - - wp_send_json_success([ - 'message' => sprintf('Se restauraron %d campos a sus valores por defecto.', $updated) - ]); - } else { - wp_send_json_error([ - 'message' => 'Error: Repositorio no disponible.' - ]); - } - } - - /** - * Mapeo de IDs de campos HTML a nombres de atributos del schema - * - * @return array - */ - private function getFieldMapping(): array - { - return [ - // ===================================================== - // TOP NOTIFICATION BAR - // ===================================================== - - // Activaci贸n y Visibilidad - 'topBarEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'topBarShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'topBarShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'topBarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Contenido - 'topBarIconClass' => ['group' => 'content', 'attribute' => 'icon_class'], - 'topBarLabelText' => ['group' => 'content', 'attribute' => 'label_text'], - 'topBarMessageText' => ['group' => 'content', 'attribute' => 'message_text'], - 'topBarLinkText' => ['group' => 'content', 'attribute' => 'link_text'], - 'topBarLinkUrl' => ['group' => 'content', 'attribute' => 'link_url'], - - // Colores - 'topBarBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'], - 'topBarTextColor' => ['group' => 'colors', 'attribute' => 'text_color'], - 'topBarLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'], - 'topBarIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'], - 'topBarLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'], - 'topBarLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'], - - // Espaciado - 'topBarFontSize' => ['group' => 'spacing', 'attribute' => 'font_size'], - 'topBarPadding' => ['group' => 'spacing', 'attribute' => 'padding'], - - // ===================================================== - // NAVBAR - // ===================================================== - - // Visibility - 'navbarEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'navbarShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'navbarShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'navbarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - 'navbarSticky' => ['group' => 'visibility', 'attribute' => 'sticky_enabled'], - - // Layout - 'navbarContainerType' => ['group' => 'layout', 'attribute' => 'container_type'], - 'navbarPaddingVertical' => ['group' => 'layout', 'attribute' => 'padding_vertical'], - 'navbarZIndex' => ['group' => 'layout', 'attribute' => 'z_index'], - - // Behavior - 'navbarMenuLocation' => ['group' => 'behavior', 'attribute' => 'menu_location'], - 'navbarCustomMenuId' => ['group' => 'behavior', 'attribute' => 'custom_menu_id'], - 'navbarEnableDropdowns' => ['group' => 'behavior', 'attribute' => 'enable_dropdowns'], - 'navbarMobileBreakpoint' => ['group' => 'behavior', 'attribute' => 'mobile_breakpoint'], - - // Media (Logo/Marca) - 'navbarShowBrand' => ['group' => 'media', 'attribute' => 'show_brand'], - 'navbarUseLogo' => ['group' => 'media', 'attribute' => 'use_logo'], - 'navbarLogoUrl' => ['group' => 'media', 'attribute' => 'logo_url'], - 'navbarLogoHeight' => ['group' => 'media', 'attribute' => 'logo_height'], - 'navbarBrandText' => ['group' => 'media', 'attribute' => 'brand_text'], - 'navbarBrandFontSize' => ['group' => 'media', 'attribute' => 'brand_font_size'], - 'navbarBrandColor' => ['group' => 'media', 'attribute' => 'brand_color'], - 'navbarBrandHoverColor' => ['group' => 'media', 'attribute' => 'brand_hover_color'], - - // Links - 'linksTextColor' => ['group' => 'links', 'attribute' => 'text_color'], - 'linksHoverColor' => ['group' => 'links', 'attribute' => 'hover_color'], - 'linksActiveColor' => ['group' => 'links', 'attribute' => 'active_color'], - 'linksFontSize' => ['group' => 'links', 'attribute' => 'font_size'], - 'linksFontWeight' => ['group' => 'links', 'attribute' => 'font_weight'], - 'linksPadding' => ['group' => 'links', 'attribute' => 'padding'], - 'linksBorderRadius' => ['group' => 'links', 'attribute' => 'border_radius'], - 'linksShowUnderline' => ['group' => 'links', 'attribute' => 'show_underline_effect'], - 'linksUnderlineColor' => ['group' => 'links', 'attribute' => 'underline_color'], - - // Visual Effects (Dropdown) - 'dropdownBgColor' => ['group' => 'visual_effects', 'attribute' => 'background_color'], - 'dropdownBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], - 'dropdownShadow' => ['group' => 'visual_effects', 'attribute' => 'shadow'], - 'dropdownItemColor' => ['group' => 'visual_effects', 'attribute' => 'item_color'], - 'dropdownItemHoverBg' => ['group' => 'visual_effects', 'attribute' => 'item_hover_background'], - 'dropdownItemPadding' => ['group' => 'visual_effects', 'attribute' => 'item_padding'], - 'dropdownMaxHeight' => ['group' => 'visual_effects', 'attribute' => 'dropdown_max_height'], - - // Colors (Navbar styles) - 'navbarBgColor' => ['group' => 'colors', 'attribute' => 'background_color'], - 'navbarBoxShadow' => ['group' => 'colors', 'attribute' => 'box_shadow'], - - // ===================================================== - // CTA LETS TALK - // ===================================================== - - // Visibility - 'ctaLetsTalkEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'ctaLetsTalkShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'ctaLetsTalkShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'ctaLetsTalkShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'ctaLetsTalkButtonText' => ['group' => 'content', 'attribute' => 'button_text'], - 'ctaLetsTalkShowIcon' => ['group' => 'content', 'attribute' => 'show_icon'], - 'ctaLetsTalkIconClass' => ['group' => 'content', 'attribute' => 'icon_class'], - 'ctaLetsTalkModalTarget' => ['group' => 'content', 'attribute' => 'modal_target'], - 'ctaLetsTalkAriaLabel' => ['group' => 'content', 'attribute' => 'aria_label'], - - // Behavior - 'ctaLetsTalkEnableModal' => ['group' => 'behavior', 'attribute' => 'enable_modal'], - 'ctaLetsTalkCustomUrl' => ['group' => 'behavior', 'attribute' => 'custom_url'], - 'ctaLetsTalkOpenNewTab' => ['group' => 'behavior', 'attribute' => 'open_in_new_tab'], - - // Typography - 'ctaLetsTalkFontSize' => ['group' => 'typography', 'attribute' => 'font_size'], - 'ctaLetsTalkFontWeight' => ['group' => 'typography', 'attribute' => 'font_weight'], - 'ctaLetsTalkTextTransform' => ['group' => 'typography', 'attribute' => 'text_transform'], - - // Colors - 'ctaLetsTalkBgColor' => ['group' => 'colors', 'attribute' => 'background_color'], - 'ctaLetsTalkBgHoverColor' => ['group' => 'colors', 'attribute' => 'background_hover_color'], - 'ctaLetsTalkTextColor' => ['group' => 'colors', 'attribute' => 'text_color'], - 'ctaLetsTalkTextHoverColor' => ['group' => 'colors', 'attribute' => 'text_hover_color'], - 'ctaLetsTalkBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'], - - // Spacing - 'ctaLetsTalkPaddingTB' => ['group' => 'spacing', 'attribute' => 'padding_top_bottom'], - 'ctaLetsTalkPaddingLR' => ['group' => 'spacing', 'attribute' => 'padding_left_right'], - 'ctaLetsTalkMarginLeft' => ['group' => 'spacing', 'attribute' => 'margin_left'], - 'ctaLetsTalkIconSpacing' => ['group' => 'spacing', 'attribute' => 'icon_spacing'], - - // Visual Effects - 'ctaLetsTalkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], - 'ctaLetsTalkBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'], - 'ctaLetsTalkBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], - 'ctaLetsTalkTransition' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - - // ===================================================== - // HERO SECTION - // ===================================================== - - // Visibility - 'heroEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'heroShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'heroShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'heroShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'heroShowCategories' => ['group' => 'content', 'attribute' => 'show_categories'], - 'heroShowBadgeIcon' => ['group' => 'content', 'attribute' => 'show_badge_icon'], - 'heroBadgeIconClass' => ['group' => 'content', 'attribute' => 'badge_icon_class'], - 'heroTitleTag' => ['group' => 'content', 'attribute' => 'title_tag'], - - // Colors - 'heroGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'], - 'heroGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'], - 'heroTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], - 'heroBadgeBgColor' => ['group' => 'colors', 'attribute' => 'badge_bg_color'], - 'heroBadgeTextColor' => ['group' => 'colors', 'attribute' => 'badge_text_color'], - 'heroBadgeIconColor' => ['group' => 'colors', 'attribute' => 'badge_icon_color'], - 'heroBadgeHoverBg' => ['group' => 'colors', 'attribute' => 'badge_hover_bg'], - - // Typography - 'heroTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], - 'heroTitleFontSizeMobile' => ['group' => 'typography', 'attribute' => 'title_font_size_mobile'], - 'heroTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], - 'heroTitleLineHeight' => ['group' => 'typography', 'attribute' => 'title_line_height'], - 'heroBadgeFontSize' => ['group' => 'typography', 'attribute' => 'badge_font_size'], - - // Spacing - 'heroPaddingVertical' => ['group' => 'spacing', 'attribute' => 'padding_vertical'], - 'heroMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'], - 'heroBadgePadding' => ['group' => 'spacing', 'attribute' => 'badge_padding'], - 'heroBadgeBorderRadius' => ['group' => 'spacing', 'attribute' => 'badge_border_radius'], - - // Visual Effects - 'heroBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], - 'heroTitleTextShadow' => ['group' => 'visual_effects', 'attribute' => 'title_text_shadow'], - 'heroBadgeBackdropBlur' => ['group' => 'visual_effects', 'attribute' => 'badge_backdrop_blur'], - - // ===================================================== - // FEATURED IMAGE - // ===================================================== - - // Visibility - 'featuredImageEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'featuredImageShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'featuredImageShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'featuredImageShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'featuredImageSize' => ['group' => 'content', 'attribute' => 'image_size'], - 'featuredImageLazyLoading' => ['group' => 'content', 'attribute' => 'lazy_loading'], - 'featuredImageLinkToMedia' => ['group' => 'content', 'attribute' => 'link_to_media'], - - // Spacing - 'featuredImageMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'], - 'featuredImageMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'], - - // Visual Effects - 'featuredImageBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], - 'featuredImageBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], - 'featuredImageHoverEffect' => ['group' => 'visual_effects', 'attribute' => 'hover_effect'], - 'featuredImageHoverScale' => ['group' => 'visual_effects', 'attribute' => 'hover_scale'], - 'featuredImageTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - - // ===================================================== - // TABLE OF CONTENTS - // ===================================================== - - // Visibility - 'tocEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'tocShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'tocShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'tocShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'tocTitle' => ['group' => 'content', 'attribute' => 'title'], - 'tocAutoGenerate' => ['group' => 'content', 'attribute' => 'auto_generate'], - 'tocHeadingLevels' => ['group' => 'content', 'attribute' => 'heading_levels'], - 'tocSmoothScroll' => ['group' => 'content', 'attribute' => 'smooth_scroll'], - - // Typography - 'tocTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], - 'tocTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], - 'tocLinkFontSize' => ['group' => 'typography', 'attribute' => 'link_font_size'], - 'tocLinkLineHeight' => ['group' => 'typography', 'attribute' => 'link_line_height'], - 'tocLevelThreeFontSize' => ['group' => 'typography', 'attribute' => 'level_three_font_size'], - 'tocLevelFourFontSize' => ['group' => 'typography', 'attribute' => 'level_four_font_size'], - - // Colors - 'tocBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'], - 'tocBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'], - 'tocTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], - 'tocTitleBorderColor' => ['group' => 'colors', 'attribute' => 'title_border_color'], - 'tocLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'], - 'tocLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'], - 'tocLinkHoverBackground' => ['group' => 'colors', 'attribute' => 'link_hover_background'], - 'tocActiveBorderColor' => ['group' => 'colors', 'attribute' => 'active_border_color'], - 'tocActiveBackgroundColor' => ['group' => 'colors', 'attribute' => 'active_background_color'], - 'tocActiveTextColor' => ['group' => 'colors', 'attribute' => 'active_text_color'], - 'tocScrollbarTrackColor' => ['group' => 'colors', 'attribute' => 'scrollbar_track_color'], - 'tocScrollbarThumbColor' => ['group' => 'colors', 'attribute' => 'scrollbar_thumb_color'], - - // Spacing - 'tocContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'], - 'tocMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'], - 'tocTitlePaddingBottom' => ['group' => 'spacing', 'attribute' => 'title_padding_bottom'], - 'tocTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], - 'tocItemMarginBottom' => ['group' => 'spacing', 'attribute' => 'item_margin_bottom'], - 'tocLinkPadding' => ['group' => 'spacing', 'attribute' => 'link_padding'], - 'tocLevelThreePaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_three_padding_left'], - 'tocLevelFourPaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_four_padding_left'], - 'tocScrollbarWidth' => ['group' => 'spacing', 'attribute' => 'scrollbar_width'], - - // Visual Effects - 'tocBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], - 'tocBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], - 'tocBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'], - 'tocLinkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'link_border_radius'], - 'tocActiveBorderLeftWidth' => ['group' => 'visual_effects', 'attribute' => 'active_border_left_width'], - 'tocTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - 'tocScrollbarBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'scrollbar_border_radius'], - - // Behavior - 'tocIsSticky' => ['group' => 'behavior', 'attribute' => 'is_sticky'], - 'tocScrollOffset' => ['group' => 'behavior', 'attribute' => 'scroll_offset'], - 'tocMaxHeight' => ['group' => 'behavior', 'attribute' => 'max_height'], - - // ===================================================== - // SOCIAL SHARE - // ===================================================== - - // Visibility - 'socialShareEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'socialShareShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'socialShareShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'socialShareShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'socialShareShowLabel' => ['group' => 'content', 'attribute' => 'show_label'], - 'socialShareLabelText' => ['group' => 'content', 'attribute' => 'label_text'], - - // Networks - 'socialShareFacebook' => ['group' => 'networks', 'attribute' => 'show_facebook'], - 'socialShareFacebookUrl' => ['group' => 'networks', 'attribute' => 'facebook_url'], - 'socialShareInstagram' => ['group' => 'networks', 'attribute' => 'show_instagram'], - 'socialShareInstagramUrl' => ['group' => 'networks', 'attribute' => 'instagram_url'], - 'socialShareLinkedin' => ['group' => 'networks', 'attribute' => 'show_linkedin'], - 'socialShareLinkedinUrl' => ['group' => 'networks', 'attribute' => 'linkedin_url'], - 'socialShareWhatsapp' => ['group' => 'networks', 'attribute' => 'show_whatsapp'], - 'socialShareWhatsappNumber' => ['group' => 'networks', 'attribute' => 'whatsapp_number'], - 'socialShareTwitter' => ['group' => 'networks', 'attribute' => 'show_twitter'], - 'socialShareTwitterUrl' => ['group' => 'networks', 'attribute' => 'twitter_url'], - 'socialShareEmail' => ['group' => 'networks', 'attribute' => 'show_email'], - 'socialShareEmailAddress' => ['group' => 'networks', 'attribute' => 'email_address'], - - // Colors - 'socialShareLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'], - 'socialShareBorderTopColor' => ['group' => 'colors', 'attribute' => 'border_top_color'], - 'socialShareButtonBg' => ['group' => 'colors', 'attribute' => 'button_background'], - 'socialShareFacebookColor' => ['group' => 'colors', 'attribute' => 'facebook_color'], - 'socialShareInstagramColor' => ['group' => 'colors', 'attribute' => 'instagram_color'], - 'socialShareLinkedinColor' => ['group' => 'colors', 'attribute' => 'linkedin_color'], - 'socialShareWhatsappColor' => ['group' => 'colors', 'attribute' => 'whatsapp_color'], - 'socialShareTwitterColor' => ['group' => 'colors', 'attribute' => 'twitter_color'], - 'socialShareEmailColor' => ['group' => 'colors', 'attribute' => 'email_color'], - - // Typography - 'socialShareLabelFontSize' => ['group' => 'typography', 'attribute' => 'label_font_size'], - 'socialShareIconFontSize' => ['group' => 'typography', 'attribute' => 'icon_font_size'], - - // Spacing - 'socialShareMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'], - 'socialShareMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'], - 'socialSharePaddingTop' => ['group' => 'spacing', 'attribute' => 'container_padding_top'], - 'socialSharePaddingBottom' => ['group' => 'spacing', 'attribute' => 'container_padding_bottom'], - 'socialShareLabelMarginBottom' => ['group' => 'spacing', 'attribute' => 'label_margin_bottom'], - 'socialShareButtonsGap' => ['group' => 'spacing', 'attribute' => 'buttons_gap'], - 'socialShareButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'], - - // Visual Effects - 'socialShareBorderTopWidth' => ['group' => 'visual_effects', 'attribute' => 'border_top_width'], - 'socialShareButtonBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'button_border_width'], - 'socialShareButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], - 'socialShareTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - 'socialShareHoverBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'hover_box_shadow'], - - // ===================================================== - // CTA POST - // ===================================================== - - // Visibility - 'ctaPostEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'ctaPostShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'ctaPostShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'ctaPostShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'ctaPostTitle' => ['group' => 'content', 'attribute' => 'title'], - 'ctaPostDescription' => ['group' => 'content', 'attribute' => 'description'], - 'ctaPostButtonText' => ['group' => 'content', 'attribute' => 'button_text'], - 'ctaPostButtonUrl' => ['group' => 'content', 'attribute' => 'button_url'], - 'ctaPostButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'], - - // Typography - 'ctaPostTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], - 'ctaPostTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], - 'ctaPostDescriptionFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'], - 'ctaPostButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'], - - // Colors - 'ctaPostGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'], - 'ctaPostGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'], - 'ctaPostTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], - 'ctaPostDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'], - 'ctaPostButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'], - 'ctaPostButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], - 'ctaPostButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'], - - // Spacing - 'ctaPostContainerMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'], - 'ctaPostContainerMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'], - 'ctaPostContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'], - 'ctaPostTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], - 'ctaPostButtonIconMargin' => ['group' => 'spacing', 'attribute' => 'button_icon_margin'], - - // Visual Effects - 'ctaPostBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], - 'ctaPostGradientAngle' => ['group' => 'visual_effects', 'attribute' => 'gradient_angle'], - 'ctaPostButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], - 'ctaPostButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'], - 'ctaPostTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - 'ctaPostBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], - - // ===================================================== - // CONTACT FORM - // ===================================================== - - // Visibility - 'contactFormEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'contactFormShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'contactFormShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'contactFormShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'contactFormSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'], - 'contactFormSectionDescription' => ['group' => 'content', 'attribute' => 'section_description'], - 'contactFormSubmitButtonText' => ['group' => 'content', 'attribute' => 'submit_button_text'], - 'contactFormSubmitButtonIcon' => ['group' => 'content', 'attribute' => 'submit_button_icon'], - - // Contact Info - 'contactFormShowContactInfo' => ['group' => 'contact_info', 'attribute' => 'show_contact_info'], - 'contactFormPhoneLabel' => ['group' => 'contact_info', 'attribute' => 'phone_label'], - 'contactFormPhoneValue' => ['group' => 'contact_info', 'attribute' => 'phone_value'], - 'contactFormEmailLabel' => ['group' => 'contact_info', 'attribute' => 'email_label'], - 'contactFormEmailValue' => ['group' => 'contact_info', 'attribute' => 'email_value'], - 'contactFormLocationLabel' => ['group' => 'contact_info', 'attribute' => 'location_label'], - 'contactFormLocationValue' => ['group' => 'contact_info', 'attribute' => 'location_value'], - - // Form Labels - 'contactFormFullnamePlaceholder' => ['group' => 'form_labels', 'attribute' => 'fullname_placeholder'], - 'contactFormCompanyPlaceholder' => ['group' => 'form_labels', 'attribute' => 'company_placeholder'], - 'contactFormWhatsappPlaceholder' => ['group' => 'form_labels', 'attribute' => 'whatsapp_placeholder'], - 'contactFormEmailPlaceholder' => ['group' => 'form_labels', 'attribute' => 'email_placeholder'], - 'contactFormMessagePlaceholder' => ['group' => 'form_labels', 'attribute' => 'message_placeholder'], - - // Integration - 'contactFormWebhookUrl' => ['group' => 'integration', 'attribute' => 'webhook_url'], - 'contactFormWebhookMethod' => ['group' => 'integration', 'attribute' => 'webhook_method'], - 'contactFormIncludePageUrl' => ['group' => 'integration', 'attribute' => 'include_page_url'], - 'contactFormIncludeTimestamp' => ['group' => 'integration', 'attribute' => 'include_timestamp'], - - // Messages - 'contactFormSuccessMessage' => ['group' => 'messages', 'attribute' => 'success_message'], - 'contactFormErrorMessage' => ['group' => 'messages', 'attribute' => 'error_message'], - 'contactFormSendingMessage' => ['group' => 'messages', 'attribute' => 'sending_message'], - 'contactFormValidationRequired' => ['group' => 'messages', 'attribute' => 'validation_required'], - 'contactFormValidationEmail' => ['group' => 'messages', 'attribute' => 'validation_email'], - - // Colors - 'contactFormSectionBgColor' => ['group' => 'colors', 'attribute' => 'section_bg_color'], - 'contactFormTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], - 'contactFormDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'], - 'contactFormIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'], - 'contactFormInfoLabelColor' => ['group' => 'colors', 'attribute' => 'info_label_color'], - 'contactFormInfoValueColor' => ['group' => 'colors', 'attribute' => 'info_value_color'], - 'contactFormInputBorderColor' => ['group' => 'colors', 'attribute' => 'input_border_color'], - 'contactFormInputFocusBorder' => ['group' => 'colors', 'attribute' => 'input_focus_border'], - 'contactFormButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'], - 'contactFormButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], - 'contactFormButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'], - 'contactFormSuccessBgColor' => ['group' => 'colors', 'attribute' => 'success_bg_color'], - 'contactFormSuccessTextColor' => ['group' => 'colors', 'attribute' => 'success_text_color'], - 'contactFormErrorBgColor' => ['group' => 'colors', 'attribute' => 'error_bg_color'], - 'contactFormErrorTextColor' => ['group' => 'colors', 'attribute' => 'error_text_color'], - - // Spacing - 'contactFormSectionPaddingY' => ['group' => 'spacing', 'attribute' => 'section_padding_y'], - 'contactFormSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'], - 'contactFormTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], - 'contactFormDescriptionMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'], - 'contactFormFormGap' => ['group' => 'spacing', 'attribute' => 'form_gap'], - - // Visual Effects - 'contactFormInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'], - 'contactFormButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], - 'contactFormButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'], - 'contactFormTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - 'contactFormTextareaRows' => ['group' => 'visual_effects', 'attribute' => 'textarea_rows'], - - // ===================================================== - // CTA BOX SIDEBAR - // ===================================================== - - // Visibility - 'ctaEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'ctaShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'ctaShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - 'ctaShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], - - // Content - 'ctaTitle' => ['group' => 'content', 'attribute' => 'title'], - 'ctaDescription' => ['group' => 'content', 'attribute' => 'description'], - 'ctaButtonText' => ['group' => 'content', 'attribute' => 'button_text'], - 'ctaButtonIcon' => ['group' => 'content', 'attribute' => 'button_icon'], - 'ctaButtonAction' => ['group' => 'content', 'attribute' => 'button_action'], - 'ctaButtonLink' => ['group' => 'content', 'attribute' => 'button_link'], - - // Behavior - 'ctaTextAlign' => ['group' => 'behavior', 'attribute' => 'text_align'], - - // Typography - 'ctaTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], - 'ctaTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], - 'ctaDescFontSize' => ['group' => 'typography', 'attribute' => 'description_font_size'], - 'ctaButtonFontSize' => ['group' => 'typography', 'attribute' => 'button_font_size'], - 'ctaButtonFontWeight' => ['group' => 'typography', 'attribute' => 'button_font_weight'], - - // Colors - 'ctaBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'], - 'ctaTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], - 'ctaDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'], - 'ctaButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_background_color'], - 'ctaButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], - 'ctaButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_background'], - 'ctaButtonHoverText' => ['group' => 'colors', 'attribute' => 'button_hover_text_color'], - - // Spacing - 'ctaContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'], - 'ctaTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], - 'ctaDescMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'], - 'ctaButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'], - 'ctaIconMarginRight' => ['group' => 'spacing', 'attribute' => 'icon_margin_right'], - - // Visual Effects - 'ctaBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], - 'ctaButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], - 'ctaBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], - 'ctaTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - - // ===================================================== - // FOOTER - // ===================================================== - - // Visibility - 'footerEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], - 'footerShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], - 'footerShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], - - // Widget 1 - 'footerWidget1Visible' => ['group' => 'widget_1', 'attribute' => 'widget_1_visible'], - 'footerWidget1Title' => ['group' => 'widget_1', 'attribute' => 'widget_1_title'], - - // Widget 2 - 'footerWidget2Visible' => ['group' => 'widget_2', 'attribute' => 'widget_2_visible'], - 'footerWidget2Title' => ['group' => 'widget_2', 'attribute' => 'widget_2_title'], - - // Widget 3 - 'footerWidget3Visible' => ['group' => 'widget_3', 'attribute' => 'widget_3_visible'], - 'footerWidget3Title' => ['group' => 'widget_3', 'attribute' => 'widget_3_title'], - - // Newsletter - 'footerNewsletterVisible' => ['group' => 'newsletter', 'attribute' => 'newsletter_visible'], - 'footerNewsletterTitle' => ['group' => 'newsletter', 'attribute' => 'newsletter_title'], - 'footerNewsletterDescription' => ['group' => 'newsletter', 'attribute' => 'newsletter_description'], - 'footerNewsletterPlaceholder' => ['group' => 'newsletter', 'attribute' => 'newsletter_email_placeholder'], - 'footerNewsletterButtonText' => ['group' => 'newsletter', 'attribute' => 'newsletter_button_text'], - 'footerNewsletterWebhookUrl' => ['group' => 'newsletter', 'attribute' => 'newsletter_webhook_url'], - 'footerNewsletterSuccessMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_success_message'], - 'footerNewsletterErrorMessage' => ['group' => 'newsletter', 'attribute' => 'newsletter_error_message'], - - // Footer Bottom - 'footerCopyrightText' => ['group' => 'footer_bottom', 'attribute' => 'copyright_text'], - - // Colors - 'footerBgColor' => ['group' => 'colors', 'attribute' => 'bg_color'], - 'footerTextColor' => ['group' => 'colors', 'attribute' => 'text_color'], - 'footerTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], - 'footerLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'], - 'footerLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'], - 'footerButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'], - 'footerButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'], - 'footerButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'], - - // Spacing - 'footerPaddingY' => ['group' => 'spacing', 'attribute' => 'padding_y'], - 'footerMarginTop' => ['group' => 'spacing', 'attribute' => 'margin_top'], - - // Visual Effects - 'footerInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'], - 'footerButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], - 'footerTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], - ]; - } -} diff --git a/Admin/Navbar/Infrastructure/FieldMapping/NavbarFieldMapper.php b/Admin/Navbar/Infrastructure/FieldMapping/NavbarFieldMapper.php new file mode 100644 index 00000000..54fe0adb --- /dev/null +++ b/Admin/Navbar/Infrastructure/FieldMapping/NavbarFieldMapper.php @@ -0,0 +1,78 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'navbarShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'navbarShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'navbarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + 'navbarSticky' => ['group' => 'visibility', 'attribute' => 'sticky_enabled'], + + // Layout + 'navbarContainerType' => ['group' => 'layout', 'attribute' => 'container_type'], + 'navbarPaddingVertical' => ['group' => 'layout', 'attribute' => 'padding_vertical'], + 'navbarZIndex' => ['group' => 'layout', 'attribute' => 'z_index'], + + // Behavior + 'navbarMenuLocation' => ['group' => 'behavior', 'attribute' => 'menu_location'], + 'navbarCustomMenuId' => ['group' => 'behavior', 'attribute' => 'custom_menu_id'], + 'navbarEnableDropdowns' => ['group' => 'behavior', 'attribute' => 'enable_dropdowns'], + 'navbarMobileBreakpoint' => ['group' => 'behavior', 'attribute' => 'mobile_breakpoint'], + + // Media (Logo/Marca) + 'navbarShowBrand' => ['group' => 'media', 'attribute' => 'show_brand'], + 'navbarUseLogo' => ['group' => 'media', 'attribute' => 'use_logo'], + 'navbarLogoUrl' => ['group' => 'media', 'attribute' => 'logo_url'], + 'navbarLogoHeight' => ['group' => 'media', 'attribute' => 'logo_height'], + 'navbarBrandText' => ['group' => 'media', 'attribute' => 'brand_text'], + 'navbarBrandFontSize' => ['group' => 'media', 'attribute' => 'brand_font_size'], + 'navbarBrandColor' => ['group' => 'media', 'attribute' => 'brand_color'], + 'navbarBrandHoverColor' => ['group' => 'media', 'attribute' => 'brand_hover_color'], + + // Links + 'linksTextColor' => ['group' => 'links', 'attribute' => 'text_color'], + 'linksHoverColor' => ['group' => 'links', 'attribute' => 'hover_color'], + 'linksActiveColor' => ['group' => 'links', 'attribute' => 'active_color'], + 'linksFontSize' => ['group' => 'links', 'attribute' => 'font_size'], + 'linksFontWeight' => ['group' => 'links', 'attribute' => 'font_weight'], + 'linksPadding' => ['group' => 'links', 'attribute' => 'padding'], + 'linksBorderRadius' => ['group' => 'links', 'attribute' => 'border_radius'], + 'linksShowUnderline' => ['group' => 'links', 'attribute' => 'show_underline_effect'], + 'linksUnderlineColor' => ['group' => 'links', 'attribute' => 'underline_color'], + + // Visual Effects (Dropdown) + 'dropdownBgColor' => ['group' => 'visual_effects', 'attribute' => 'background_color'], + 'dropdownBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], + 'dropdownShadow' => ['group' => 'visual_effects', 'attribute' => 'shadow'], + 'dropdownItemColor' => ['group' => 'visual_effects', 'attribute' => 'item_color'], + 'dropdownItemHoverBg' => ['group' => 'visual_effects', 'attribute' => 'item_hover_background'], + 'dropdownItemPadding' => ['group' => 'visual_effects', 'attribute' => 'item_padding'], + 'dropdownMaxHeight' => ['group' => 'visual_effects', 'attribute' => 'dropdown_max_height'], + + // Colors (Navbar styles) + 'navbarBgColor' => ['group' => 'colors', 'attribute' => 'background_color'], + 'navbarBoxShadow' => ['group' => 'colors', 'attribute' => 'box_shadow'], + ]; + } +} diff --git a/Admin/RelatedPost/Infrastructure/FieldMapping/RelatedPostFieldMapper.php b/Admin/RelatedPost/Infrastructure/FieldMapping/RelatedPostFieldMapper.php new file mode 100644 index 00000000..b5237712 --- /dev/null +++ b/Admin/RelatedPost/Infrastructure/FieldMapping/RelatedPostFieldMapper.php @@ -0,0 +1,77 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'relatedPostShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'relatedPostShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'relatedPostShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'relatedPostSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'], + 'relatedPostPerPage' => ['group' => 'content', 'attribute' => 'posts_per_page'], + 'relatedPostOrderby' => ['group' => 'content', 'attribute' => 'orderby'], + 'relatedPostOrder' => ['group' => 'content', 'attribute' => 'order'], + 'relatedPostShowPagination' => ['group' => 'content', 'attribute' => 'show_pagination'], + + // Layout + 'relatedPostColsDesktop' => ['group' => 'layout', 'attribute' => 'columns_desktop'], + 'relatedPostColsTablet' => ['group' => 'layout', 'attribute' => 'columns_tablet'], + 'relatedPostColsMobile' => ['group' => 'layout', 'attribute' => 'columns_mobile'], + + // Typography + 'relatedPostSectionTitleSize' => ['group' => 'typography', 'attribute' => 'section_title_size'], + 'relatedPostSectionTitleWeight' => ['group' => 'typography', 'attribute' => 'section_title_weight'], + 'relatedPostCardTitleSize' => ['group' => 'typography', 'attribute' => 'card_title_size'], + 'relatedPostCardTitleWeight' => ['group' => 'typography', 'attribute' => 'card_title_weight'], + + // Colors + 'relatedPostSectionTitleColor' => ['group' => 'colors', 'attribute' => 'section_title_color'], + 'relatedPostCardBgColor' => ['group' => 'colors', 'attribute' => 'card_bg_color'], + 'relatedPostCardTitleColor' => ['group' => 'colors', 'attribute' => 'card_title_color'], + 'relatedPostCardHoverBgColor' => ['group' => 'colors', 'attribute' => 'card_hover_bg_color'], + 'relatedPostPaginationBgColor' => ['group' => 'colors', 'attribute' => 'pagination_bg_color'], + 'relatedPostPaginationTextColor' => ['group' => 'colors', 'attribute' => 'pagination_text_color'], + 'relatedPostPaginationActiveBg' => ['group' => 'colors', 'attribute' => 'pagination_active_bg'], + 'relatedPostPaginationActiveText' => ['group' => 'colors', 'attribute' => 'pagination_active_text'], + + // Spacing + 'relatedPostSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'], + 'relatedPostSectionMarginBottom' => ['group' => 'spacing', 'attribute' => 'section_margin_bottom'], + 'relatedPostTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], + 'relatedPostGridGap' => ['group' => 'spacing', 'attribute' => 'grid_gap'], + 'relatedPostCardPadding' => ['group' => 'spacing', 'attribute' => 'card_padding'], + 'relatedPostPaginationMarginTop' => ['group' => 'spacing', 'attribute' => 'pagination_margin_top'], + + // Visual Effects + 'relatedPostCardBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'card_border_radius'], + 'relatedPostCardShadow' => ['group' => 'visual_effects', 'attribute' => 'card_shadow'], + 'relatedPostCardHoverShadow' => ['group' => 'visual_effects', 'attribute' => 'card_hover_shadow'], + 'relatedPostCardTransition' => ['group' => 'visual_effects', 'attribute' => 'card_transition'], + ]; + } +} diff --git a/Admin/Shared/Domain/Contracts/FieldMapperInterface.php b/Admin/Shared/Domain/Contracts/FieldMapperInterface.php new file mode 100644 index 00000000..b3571c59 --- /dev/null +++ b/Admin/Shared/Domain/Contracts/FieldMapperInterface.php @@ -0,0 +1,38 @@ + + * + * Ejemplo: + * [ + * 'ctaTitle' => ['group' => 'content', 'attribute' => 'title'], + * 'ctaEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'], + * ] + */ + public function getFieldMapping(): array; +} diff --git a/Admin/Shared/Infrastructure/Api/Wordpress/AdminAjaxHandler.php b/Admin/Shared/Infrastructure/Api/Wordpress/AdminAjaxHandler.php new file mode 100644 index 00000000..cb84f69d --- /dev/null +++ b/Admin/Shared/Infrastructure/Api/Wordpress/AdminAjaxHandler.php @@ -0,0 +1,145 @@ + 'No tienes permisos para realizar esta accion.']); + } + + $component = sanitize_text_field($_POST['component'] ?? ''); + $settings = json_decode(stripslashes($_POST['settings'] ?? '{}'), true); + + if (empty($component) || empty($settings)) { + wp_send_json_error(['message' => 'Datos incompletos.']); + } + + // Obtener mapper del modulo correspondiente + if ($this->fieldMapperRegistry === null || !$this->fieldMapperRegistry->hasMapper($component)) { + wp_send_json_error([ + 'message' => "No existe mapper para el componente: {$component}" + ]); + } + + $mapper = $this->fieldMapperRegistry->getMapper($component); + $fieldMapping = $mapper->getFieldMapping(); + + // Mapear settings usando el mapper del modulo + $mappedSettings = $this->mapSettings($settings, $fieldMapping); + + // Guardar usando Use Case + if ($this->saveComponentSettingsUseCase !== null) { + $updated = $this->saveComponentSettingsUseCase->execute($component, $mappedSettings); + wp_send_json_success([ + 'message' => sprintf('Se guardaron %d campos correctamente.', $updated) + ]); + } else { + wp_send_json_error(['message' => 'Error: Use Case no disponible.']); + } + } + + /** + * Mapea settings de field IDs a grupos/atributos + */ + private function mapSettings(array $settings, array $fieldMapping): array + { + $mappedSettings = []; + + foreach ($settings as $fieldId => $value) { + if (!isset($fieldMapping[$fieldId])) { + continue; + } + + $mapping = $fieldMapping[$fieldId]; + $groupName = $mapping['group']; + $attributeName = $mapping['attribute']; + + if (!isset($mappedSettings[$groupName])) { + $mappedSettings[$groupName] = []; + } + + $mappedSettings[$groupName][$attributeName] = $value; + } + + return $mappedSettings; + } + + public function resetComponentDefaults(): void + { + // Verificar nonce + check_ajax_referer('roi_admin_dashboard', 'nonce'); + + // Verificar permisos + if (!current_user_can('manage_options')) { + wp_send_json_error([ + 'message' => 'No tienes permisos para realizar esta accion.' + ]); + } + + // Obtener componente + $component = sanitize_text_field($_POST['component'] ?? ''); + + if (empty($component)) { + wp_send_json_error([ + 'message' => 'Componente no especificado.' + ]); + } + + // Ruta al schema JSON + $schemaPath = get_template_directory() . '/Schemas/' . $component . '.json'; + + if (!file_exists($schemaPath)) { + wp_send_json_error([ + 'message' => 'Schema del componente no encontrado.' + ]); + } + + // Usar repositorio para restaurar valores + if ($this->saveComponentSettingsUseCase !== null) { + global $wpdb; + $repository = new \ROITheme\Shared\Infrastructure\Persistence\Wordpress\WordPressComponentSettingsRepository($wpdb); + $updated = $repository->resetToDefaults($component, $schemaPath); + + wp_send_json_success([ + 'message' => sprintf('Se restauraron %d campos a sus valores por defecto.', $updated) + ]); + } else { + wp_send_json_error([ + 'message' => 'Error: Repositorio no disponible.' + ]); + } + } +} diff --git a/Admin/Shared/Infrastructure/FieldMapping/FieldMapperProvider.php b/Admin/Shared/Infrastructure/FieldMapping/FieldMapperProvider.php new file mode 100644 index 00000000..fc6af168 --- /dev/null +++ b/Admin/Shared/Infrastructure/FieldMapping/FieldMapperProvider.php @@ -0,0 +1,68 @@ +registerIfExists($module); + } + } + + /** + * Registra un mapper si existe la clase + */ + private function registerIfExists(string $module): void + { + $className = sprintf( + 'ROITheme\\Admin\\%s\\Infrastructure\\FieldMapping\\%sFieldMapper', + $module, + $module + ); + + if (class_exists($className)) { + $mapper = new $className(); + if ($mapper instanceof FieldMapperInterface) { + $this->registry->register($mapper); + } + } + } +} diff --git a/Admin/Shared/Infrastructure/FieldMapping/FieldMapperRegistry.php b/Admin/Shared/Infrastructure/FieldMapping/FieldMapperRegistry.php new file mode 100644 index 00000000..de165275 --- /dev/null +++ b/Admin/Shared/Infrastructure/FieldMapping/FieldMapperRegistry.php @@ -0,0 +1,65 @@ + */ + private array $mappers = []; + + /** + * Registra un mapper + */ + public function register(FieldMapperInterface $mapper): void + { + $this->mappers[$mapper->getComponentName()] = $mapper; + } + + /** + * Obtiene un mapper por nombre de componente + * + * @throws \InvalidArgumentException Si no existe mapper para el componente + */ + public function getMapper(string $componentName): FieldMapperInterface + { + if (!isset($this->mappers[$componentName])) { + throw new \InvalidArgumentException( + "No field mapper registered for component: {$componentName}" + ); + } + + return $this->mappers[$componentName]; + } + + /** + * Verifica si existe mapper para un componente + */ + public function hasMapper(string $componentName): bool + { + return isset($this->mappers[$componentName]); + } + + /** + * Obtiene todos los mappers registrados + * + * @return array + */ + public function getAllMappers(): array + { + return $this->mappers; + } +} diff --git a/Admin/SocialShare/Infrastructure/FieldMapping/SocialShareFieldMapper.php b/Admin/SocialShare/Infrastructure/FieldMapping/SocialShareFieldMapper.php new file mode 100644 index 00000000..c0dc6162 --- /dev/null +++ b/Admin/SocialShare/Infrastructure/FieldMapping/SocialShareFieldMapper.php @@ -0,0 +1,81 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'socialShareShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'socialShareShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'socialShareShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'socialShareShowLabel' => ['group' => 'content', 'attribute' => 'show_label'], + 'socialShareLabelText' => ['group' => 'content', 'attribute' => 'label_text'], + + // Networks + 'socialShareFacebook' => ['group' => 'networks', 'attribute' => 'show_facebook'], + 'socialShareFacebookUrl' => ['group' => 'networks', 'attribute' => 'facebook_url'], + 'socialShareInstagram' => ['group' => 'networks', 'attribute' => 'show_instagram'], + 'socialShareInstagramUrl' => ['group' => 'networks', 'attribute' => 'instagram_url'], + 'socialShareLinkedin' => ['group' => 'networks', 'attribute' => 'show_linkedin'], + 'socialShareLinkedinUrl' => ['group' => 'networks', 'attribute' => 'linkedin_url'], + 'socialShareWhatsapp' => ['group' => 'networks', 'attribute' => 'show_whatsapp'], + 'socialShareWhatsappNumber' => ['group' => 'networks', 'attribute' => 'whatsapp_number'], + 'socialShareTwitter' => ['group' => 'networks', 'attribute' => 'show_twitter'], + 'socialShareTwitterUrl' => ['group' => 'networks', 'attribute' => 'twitter_url'], + 'socialShareEmail' => ['group' => 'networks', 'attribute' => 'show_email'], + 'socialShareEmailAddress' => ['group' => 'networks', 'attribute' => 'email_address'], + + // Colors + 'socialShareLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'], + 'socialShareBorderTopColor' => ['group' => 'colors', 'attribute' => 'border_top_color'], + 'socialShareButtonBg' => ['group' => 'colors', 'attribute' => 'button_background'], + 'socialShareFacebookColor' => ['group' => 'colors', 'attribute' => 'facebook_color'], + 'socialShareInstagramColor' => ['group' => 'colors', 'attribute' => 'instagram_color'], + 'socialShareLinkedinColor' => ['group' => 'colors', 'attribute' => 'linkedin_color'], + 'socialShareWhatsappColor' => ['group' => 'colors', 'attribute' => 'whatsapp_color'], + 'socialShareTwitterColor' => ['group' => 'colors', 'attribute' => 'twitter_color'], + 'socialShareEmailColor' => ['group' => 'colors', 'attribute' => 'email_color'], + + // Typography + 'socialShareLabelFontSize' => ['group' => 'typography', 'attribute' => 'label_font_size'], + 'socialShareIconFontSize' => ['group' => 'typography', 'attribute' => 'icon_font_size'], + + // Spacing + 'socialShareMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'], + 'socialShareMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'], + 'socialSharePaddingTop' => ['group' => 'spacing', 'attribute' => 'container_padding_top'], + 'socialSharePaddingBottom' => ['group' => 'spacing', 'attribute' => 'container_padding_bottom'], + 'socialShareLabelMarginBottom' => ['group' => 'spacing', 'attribute' => 'label_margin_bottom'], + 'socialShareButtonsGap' => ['group' => 'spacing', 'attribute' => 'buttons_gap'], + 'socialShareButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'], + + // Visual Effects + 'socialShareBorderTopWidth' => ['group' => 'visual_effects', 'attribute' => 'border_top_width'], + 'socialShareButtonBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'button_border_width'], + 'socialShareButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'], + 'socialShareTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + 'socialShareHoverBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'hover_box_shadow'], + ]; + } +} diff --git a/Admin/TableOfContents/Infrastructure/FieldMapping/TableOfContentsFieldMapper.php b/Admin/TableOfContents/Infrastructure/FieldMapping/TableOfContentsFieldMapper.php new file mode 100644 index 00000000..72dc09a7 --- /dev/null +++ b/Admin/TableOfContents/Infrastructure/FieldMapping/TableOfContentsFieldMapper.php @@ -0,0 +1,85 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'tocShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'tocShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'tocShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'tocTitle' => ['group' => 'content', 'attribute' => 'title'], + 'tocAutoGenerate' => ['group' => 'content', 'attribute' => 'auto_generate'], + 'tocHeadingLevels' => ['group' => 'content', 'attribute' => 'heading_levels'], + 'tocSmoothScroll' => ['group' => 'content', 'attribute' => 'smooth_scroll'], + + // Typography + 'tocTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'], + 'tocTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'], + 'tocLinkFontSize' => ['group' => 'typography', 'attribute' => 'link_font_size'], + 'tocLinkLineHeight' => ['group' => 'typography', 'attribute' => 'link_line_height'], + 'tocLevelThreeFontSize' => ['group' => 'typography', 'attribute' => 'level_three_font_size'], + 'tocLevelFourFontSize' => ['group' => 'typography', 'attribute' => 'level_four_font_size'], + + // Colors + 'tocBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'], + 'tocBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'], + 'tocTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'], + 'tocTitleBorderColor' => ['group' => 'colors', 'attribute' => 'title_border_color'], + 'tocLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'], + 'tocLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'], + 'tocLinkHoverBackground' => ['group' => 'colors', 'attribute' => 'link_hover_background'], + 'tocActiveBorderColor' => ['group' => 'colors', 'attribute' => 'active_border_color'], + 'tocActiveBackgroundColor' => ['group' => 'colors', 'attribute' => 'active_background_color'], + 'tocActiveTextColor' => ['group' => 'colors', 'attribute' => 'active_text_color'], + 'tocScrollbarTrackColor' => ['group' => 'colors', 'attribute' => 'scrollbar_track_color'], + 'tocScrollbarThumbColor' => ['group' => 'colors', 'attribute' => 'scrollbar_thumb_color'], + + // Spacing + 'tocContainerPadding' => ['group' => 'spacing', 'attribute' => 'container_padding'], + 'tocMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'], + 'tocTitlePaddingBottom' => ['group' => 'spacing', 'attribute' => 'title_padding_bottom'], + 'tocTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'], + 'tocItemMarginBottom' => ['group' => 'spacing', 'attribute' => 'item_margin_bottom'], + 'tocLinkPadding' => ['group' => 'spacing', 'attribute' => 'link_padding'], + 'tocLevelThreePaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_three_padding_left'], + 'tocLevelFourPaddingLeft' => ['group' => 'spacing', 'attribute' => 'level_four_padding_left'], + 'tocScrollbarWidth' => ['group' => 'spacing', 'attribute' => 'scrollbar_width'], + + // Visual Effects + 'tocBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'], + 'tocBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'], + 'tocBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'], + 'tocLinkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'link_border_radius'], + 'tocActiveBorderLeftWidth' => ['group' => 'visual_effects', 'attribute' => 'active_border_left_width'], + 'tocTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'], + 'tocScrollbarBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'scrollbar_border_radius'], + + // Behavior + 'tocIsSticky' => ['group' => 'behavior', 'attribute' => 'is_sticky'], + 'tocScrollOffset' => ['group' => 'behavior', 'attribute' => 'scroll_offset'], + 'tocMaxHeight' => ['group' => 'behavior', 'attribute' => 'max_height'], + ]; + } +} diff --git a/Admin/TopNotificationBar/Infrastructure/FieldMapping/TopNotificationBarFieldMapper.php b/Admin/TopNotificationBar/Infrastructure/FieldMapping/TopNotificationBarFieldMapper.php new file mode 100644 index 00000000..f5f8f163 --- /dev/null +++ b/Admin/TopNotificationBar/Infrastructure/FieldMapping/TopNotificationBarFieldMapper.php @@ -0,0 +1,51 @@ + ['group' => 'visibility', 'attribute' => 'is_enabled'], + 'topBarShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'], + 'topBarShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'], + 'topBarShowOnPages' => ['group' => 'visibility', 'attribute' => 'show_on_pages'], + + // Content + 'topBarIconClass' => ['group' => 'content', 'attribute' => 'icon_class'], + 'topBarLabelText' => ['group' => 'content', 'attribute' => 'label_text'], + 'topBarMessageText' => ['group' => 'content', 'attribute' => 'message_text'], + 'topBarLinkText' => ['group' => 'content', 'attribute' => 'link_text'], + 'topBarLinkUrl' => ['group' => 'content', 'attribute' => 'link_url'], + + // Colors + 'topBarBackgroundColor' => ['group' => 'colors', 'attribute' => 'background_color'], + 'topBarTextColor' => ['group' => 'colors', 'attribute' => 'text_color'], + 'topBarLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'], + 'topBarIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'], + 'topBarLinkColor' => ['group' => 'colors', 'attribute' => 'link_color'], + 'topBarLinkHoverColor' => ['group' => 'colors', 'attribute' => 'link_hover_color'], + + // Spacing + 'topBarFontSize' => ['group' => 'spacing', 'attribute' => 'font_size'], + 'topBarPadding' => ['group' => 'spacing', 'attribute' => 'padding'], + ]; + } +} diff --git a/functions.php b/functions.php index 21c90f42..c65fab57 100644 --- a/functions.php +++ b/functions.php @@ -126,8 +126,16 @@ try { // Obtener Use Case para guardar configuraciones $saveComponentSettingsUseCase = $container?->getSaveComponentSettingsUseCase(); - // Crear y registrar el handler AJAX con inyecci贸n del Use Case - $adminAjaxHandler = new \ROITheme\Admin\Infrastructure\Api\Wordpress\AdminAjaxHandler($saveComponentSettingsUseCase); + // === FIELD MAPPER REGISTRY (Auto-registro escalable) === + $fieldMapperRegistry = new \ROITheme\Admin\Shared\Infrastructure\FieldMapping\FieldMapperRegistry(); + $fieldMapperProvider = new \ROITheme\Admin\Shared\Infrastructure\FieldMapping\FieldMapperProvider($fieldMapperRegistry); + $fieldMapperProvider->registerAll(); + + // === ADMIN AJAX HANDLER === + $adminAjaxHandler = new \ROITheme\Admin\Shared\Infrastructure\Api\Wordpress\AdminAjaxHandler( + $saveComponentSettingsUseCase, + $fieldMapperRegistry + ); $adminAjaxHandler->register(); // Crear y registrar el handler AJAX para el Contact Form (p煤blico) diff --git a/schemas/contact-form.json b/schemas/contact-form.json index 17d78e65..73d64005 100644 --- a/schemas/contact-form.json +++ b/schemas/contact-form.json @@ -82,7 +82,7 @@ "phone_label": { "type": "text", "label": "Label telefono", - "default": "Tel茅fono", + "default": "WhatsApp", "editable": true }, "phone_value": { @@ -262,7 +262,7 @@ "info_value_color": { "type": "color", "label": "Color valores info", - "default": "#6c757d", + "default": "#AAAAAA", "editable": true, "description": "text-muted" },