Files
roi-theme/Admin/RecaptchaSettings/Infrastructure/FieldMapping/RecaptchaSettingsFieldMapper.php
FrankZamora d135ec8a41 feat(api): implement recaptcha v3 anti-spam protection
- 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>
2026-01-08 17:01:46 -06:00

43 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace ROITheme\Admin\RecaptchaSettings\Infrastructure\FieldMapping;
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
/**
* Field Mapper para reCAPTCHA Settings
*
* RESPONSABILIDAD:
* - Mapear field IDs del formulario a atributos de BD
* - Solo conoce sus propios campos (modularidad)
*
* @package ROITheme\Admin\RecaptchaSettings\Infrastructure\FieldMapping
*/
final class RecaptchaSettingsFieldMapper implements FieldMapperInterface
{
public function getComponentName(): string
{
return 'recaptcha-settings';
}
public function getFieldMapping(): array
{
return [
// Visibility
'recaptchaIsEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
// Credentials
'recaptchaSiteKey' => ['group' => 'credentials', 'attribute' => 'site_key'],
'recaptchaSecretKey' => ['group' => 'credentials', 'attribute' => 'secret_key'],
// Behavior
'recaptchaScoreThreshold' => ['group' => 'behavior', 'attribute' => 'score_threshold'],
'recaptchaActionNewsletter' => ['group' => 'behavior', 'attribute' => 'action_newsletter'],
'recaptchaActionContact' => ['group' => 'behavior', 'attribute' => 'action_contact'],
'recaptchaFailOpen' => ['group' => 'behavior', 'attribute' => 'fail_open'],
'recaptchaLogBlocked' => ['group' => 'behavior', 'attribute' => 'log_blocked'],
];
}
}