- Add RecaptchaValidatorInterface and RecaptchaResult entity in Domain - Create RecaptchaValidationService in Application layer - Implement GoogleRecaptchaValidator for API integration - Add recaptcha-settings schema and admin FormBuilder - Integrate reCAPTCHA validation in NewsletterAjaxHandler - Integrate reCAPTCHA validation in ContactFormAjaxHandler - Update FooterRenderer and ContactFormRenderer with reCAPTCHA scripts - Configure DIContainer with RecaptchaValidationService injection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
74 lines
1.8 KiB
PHP
74 lines
1.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace ROITheme\Admin\Shared\Infrastructure\FieldMapping;
|
|
|
|
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
|
|
|
|
/**
|
|
* Provider para auto-registro de Field Mappers
|
|
*
|
|
* RESPONSABILIDAD:
|
|
* - Descubrir automaticamente FieldMappers en cada modulo
|
|
* - Registrarlos en el FieldMapperRegistry
|
|
*
|
|
* BENEFICIO:
|
|
* - Agregar nuevo componente = crear FieldMapper (sin tocar functions.php)
|
|
* - Eliminar componente = borrar carpeta (limpieza automatica)
|
|
*/
|
|
final class FieldMapperProvider
|
|
{
|
|
private const MODULES = [
|
|
'TopNotificationBar',
|
|
'Navbar',
|
|
'CtaLetsTalk',
|
|
'Hero',
|
|
'FeaturedImage',
|
|
'TableOfContents',
|
|
'CtaBoxSidebar',
|
|
'SocialShare',
|
|
'CtaPost',
|
|
'RelatedPost',
|
|
'ContactForm',
|
|
'Footer',
|
|
'ThemeSettings',
|
|
'AdsensePlacement',
|
|
'ArchiveHeader',
|
|
'PostGrid',
|
|
'RecaptchaSettings',
|
|
];
|
|
|
|
public function __construct(
|
|
private readonly FieldMapperRegistry $registry
|
|
) {}
|
|
|
|
/**
|
|
* Registra todos los FieldMappers disponibles
|
|
*/
|
|
public function registerAll(): void
|
|
{
|
|
foreach (self::MODULES as $module) {
|
|
$this->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);
|
|
}
|
|
}
|
|
}
|
|
}
|