visibilityRepository->getVisibilityConfig($componentName); // DEBUG: Log for TOC only $debugToc = ($componentName === 'table-of-contents'); $usingDefaults = false; if (empty($config)) { // Usar defaults especificos por componente si existen $config = VisibilityDefaults::getForComponent($componentName); $usingDefaults = true; } $pageType = $this->pageTypeDetector->detect(); $visibilityField = $pageType->toVisibilityField(); $fieldValue = $config[$visibilityField] ?? true; $result = $this->toBool($fieldValue); if ($debugToc) { error_log("EvaluatePageVisibility [{$componentName}]: pageType=" . $pageType->value() . ", field={$visibilityField}, fieldValue=" . var_export($fieldValue, true) . ", result=" . ($result ? "true" : "false") . ", usingDefaults=" . ($usingDefaults ? "true" : "false")); error_log("EvaluatePageVisibility [{$componentName}]: config=" . json_encode($config)); } return $result; } private function toBool(mixed $value): bool { return $value === true || $value === '1' || $value === 1; } }