fix(php): support advanced incontent slot names in renderer

The getLocationConfig regex only matched post_content_X but advanced
incontent uses post_content_adv_X format. Added new regex pattern.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-12-10 11:33:53 -06:00
parent 18bf3d191c
commit 2cb7363cbb

View File

@@ -111,15 +111,24 @@ final class AdsensePlacementRenderer
{
$locationKey = str_replace('-', '_', $location);
// Manejar ubicaciones de in-content (post_content_1, post_content_2, etc.)
// Manejar ubicaciones de in-content legacy (post_content_1, post_content_2, etc.)
if (preg_match('/^post_content_(\d+)$/', $locationKey, $matches)) {
// In-content ads heredan la configuracion de post_content
// In-content ads heredan la configuracion de post_content (modo solo parrafos)
return [
'enabled' => $settings['behavior']['post_content_enabled'] ?? false,
'format' => $settings['behavior']['post_content_format'] ?? 'in-article',
];
}
// Manejar ubicaciones de in-content avanzado (post_content_adv_1, post_content_adv_2, etc.)
if (preg_match('/^post_content_adv_(\d+)$/', $locationKey, $matches)) {
// In-content ads avanzados usan configuracion de incontent_advanced
return [
'enabled' => true, // Siempre enabled porque ya pasaron los filtros en ContentAdInjector
'format' => $settings['incontent_advanced']['incontent_format'] ?? 'in-article',
];
}
// Mapeo de ubicaciones a grupos y campos
$locationMap = [
'post_top' => ['group' => 'behavior', 'enabled' => 'post_top_enabled', 'format' => 'post_top_format'],