You've already forked wc-licensed-product
Use PHP rendering for statistics page
Skip Twig template and use direct PHP rendering for better stability and debugging. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -303,27 +303,7 @@ class AnalyticsController
|
||||
{
|
||||
$stats = $this->licenseManager->getStatistics();
|
||||
|
||||
// Render using Twig if available
|
||||
$plugin = \Jeremias\WcLicensedProduct\Plugin::getInstance();
|
||||
$twig = $plugin->getTwig();
|
||||
|
||||
if ($twig) {
|
||||
try {
|
||||
echo $twig->render('admin/statistics.html.twig', [
|
||||
'stats' => $stats,
|
||||
'admin_url' => admin_url('admin.php'),
|
||||
'rest_url' => rest_url('wc-licensed-product/v1/analytics/'),
|
||||
]);
|
||||
return;
|
||||
} catch (\Twig\Error\Error $e) {
|
||||
// Any Twig error - fall through to PHP fallback
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('WC Licensed Product Twig Error: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback PHP rendering
|
||||
// Use PHP rendering directly for stability
|
||||
$this->renderStatisticsPageFallback($stats);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user