Files
roi-theme/Admin/Shared/Domain/Contracts/FieldMapperInterface.php
FrankZamora 4f11c2c312 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>
2025-11-26 20:18:55 -06:00

39 lines
1005 B
PHP

<?php
declare(strict_types=1);
namespace ROITheme\Admin\Shared\Domain\Contracts;
/**
* Contrato para mapeo de campos de formulario a atributos de BD
*
* RESPONSABILIDAD:
* - Definir el mapeo de field IDs a grupos/atributos
* - Cada modulo implementa su propio mapper
*
* PRINCIPIOS:
* - ISP: Interfaz pequena (2 metodos)
* - DIP: Capas superiores dependen de esta abstraccion
*/
interface FieldMapperInterface
{
/**
* Retorna el nombre del componente que mapea
*
* @return string Nombre en kebab-case (ej: 'cta-box-sidebar')
*/
public function getComponentName(): string;
/**
* Retorna el mapeo de field IDs a grupo/atributo
*
* @return array<string, array{group: string, attribute: string}>
*
* Ejemplo:
* [
* 'ctaTitle' => ['group' => 'content', 'attribute' => 'title'],
* 'ctaEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
* ]
*/
public function getFieldMapping(): array;
}