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