Files
roi-theme/Admin/ThemeSettings/Infrastructure/FieldMapping/ThemeSettingsFieldMapper.php
FrankZamora f35b60ed4e feat(admin): Add Google AdSense Auto Ads support to theme-settings
- Add adsense group to theme-settings.json schema (v1.2.0)
- Add adsense_publisher_id and adsense_auto_ads fields
- Add AdSense card UI in ThemeSettingsFormBuilder
- Add field mappings in ThemeSettingsFieldMapper
- Add renderAdSenseAutoAds() method in ThemeSettingsRenderer
- Inject AdSense script in wp_head when configured

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:06:42 -06:00

42 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace ROITheme\Admin\ThemeSettings\Infrastructure\FieldMapping;
use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;
/**
* Field Mapper para Theme Settings
*
* RESPONSABILIDAD:
* - Mapear field IDs del formulario a atributos de BD
* - Solo conoce sus propios campos (modularidad)
*
* NOTA: Logo/branding se gestiona desde el componente navbar
*/
final class ThemeSettingsFieldMapper implements FieldMapperInterface
{
public function getComponentName(): string
{
return 'theme-settings';
}
public function getFieldMapping(): array
{
return [
// Analytics
'themeSettingsGaTrackingId' => ['group' => 'analytics', 'attribute' => 'ga_tracking_id'],
'themeSettingsGaAnonymizeIp' => ['group' => 'analytics', 'attribute' => 'ga_anonymize_ip'],
// AdSense
'themeSettingsAdsensePublisherId' => ['group' => 'adsense', 'attribute' => 'adsense_publisher_id'],
'themeSettingsAdsenseAutoAds' => ['group' => 'adsense', 'attribute' => 'adsense_auto_ads'],
// Custom Code
'themeSettingsCustomCss' => ['group' => 'custom_code', 'attribute' => 'custom_css'],
'themeSettingsCustomJsHeader' => ['group' => 'custom_code', 'attribute' => 'custom_js_header'],
'themeSettingsCustomJsFooter' => ['group' => 'custom_code', 'attribute' => 'custom_js_footer'],
];
}
}