From 2cb7363cbbbd632a040732b64e3669672dc52f83 Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Wed, 10 Dec 2025 11:33:53 -0600 Subject: [PATCH] fix(php): support advanced incontent slot names in renderer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../Infrastructure/Ui/AdsensePlacementRenderer.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php b/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php index fdd56860..c7b59a3e 100644 --- a/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php +++ b/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php @@ -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'],