- 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>
77 lines
3.8 KiB
PHP
77 lines
3.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace ROITheme\Admin\CtaBoxSidebar\Infrastructure\FieldMapping;
|
|
|
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
|
|
|
/**
|
|
* Field Mapper para CTA Box Sidebar
|
|
*
|
|
* RESPONSABILIDAD:
|
|
* - Mapear field IDs del formulario a atributos de BD
|
|
* - Solo conoce sus propios campos (modularidad)
|
|
*
|
|
* UBICACION:
|
|
* - Dentro del modulo CtaBoxSidebar (autocontenido)
|
|
* - Eliminar modulo = eliminar mapper
|
|
*/
|
|
final class CtaBoxSidebarFieldMapper implements FieldMapperInterface
|
|
{
|
|
public function getComponentName(): string
|
|
{
|
|
return 'cta-box-sidebar';
|
|
}
|
|
|
|
public function getFieldMapping(): array
|
|
{
|
|
return [
|
|
// 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'],
|
|
];
|
|
}
|
|
}
|