fix(php): toc fallback to raw content when filtered has no headings

When plugins like Thrive Visual Editor transform content for
non-logged users, headings may be removed from the filtered content.
This fix uses raw post_content as fallback when filtered content
has no headings but raw content does.

Also removes temporary debug logging added for diagnosis.

🤖 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-06 23:08:24 -06:00
parent 83d113d669
commit b509b1a2b4
5 changed files with 16 additions and 76 deletions

View File

@@ -36,16 +36,9 @@ final class EvaluateComponentVisibilityUseCase
*/
public function execute(string $componentName): bool
{
// DEBUG: Log for TOC only
$debugToc = ($componentName === 'table-of-contents');
// Paso 1: Verificar visibilidad por tipo de pagina
$visibleByPageType = $this->pageVisibilityUseCase->execute($componentName);
if ($debugToc) {
error_log("EvaluateComponentVisibility [{$componentName}]: visibleByPageType=" . ($visibleByPageType ? "true" : "false"));
}
if (!$visibleByPageType) {
return false;
}
@@ -53,10 +46,6 @@ final class EvaluateComponentVisibilityUseCase
// Paso 2: Verificar exclusiones
$isExcluded = $this->exclusionsUseCase->execute($componentName);
if ($debugToc) {
error_log("EvaluateComponentVisibility [{$componentName}]: isExcluded=" . ($isExcluded ? "true" : "false"));
}
// Mostrar si NO esta excluido
return !$isExcluded;
}