refactor(admin): Migrate AdminAjaxHandler to Clean Architecture

- 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 <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-26 20:18:55 -06:00
parent 1a4d9d8c08
commit 4f11c2c312
19 changed files with 1199 additions and 703 deletions

View File

@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace ROITheme\Admin\Footer\Infrastructure\FieldMapping;
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
/**
* Field Mapper para Footer
*
* RESPONSABILIDAD:
* - Mapear field IDs del formulario a atributos de BD
* - Solo conoce sus propios campos (modularidad)
*/
final class FooterFieldMapper implements FieldMapperInterface
{
public function getComponentName(): string
{
return 'footer';
}
public function getFieldMapping(): array
{
return [
// 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'],
];
}
}