diff --git a/pterosync/hooks.php b/pterosync/hooks.php
index 6aec1b2..cb03b07 100644
--- a/pterosync/hooks.php
+++ b/pterosync/hooks.php
@@ -28,17 +28,49 @@
return $params;
});
+
add_hook('AdminAreaHeadOutput', 1, function ($params) {
- $url = PteroSyncInstance::get()->cssPath;
- return '' . PHP_EOL;
+ // Only load on pterosync-related admin pages:
+ // - Product module settings (configproducts.php with module=pterosync)
+ // - Service details pages for pterosync products
+ $filename = $params['filename'] ?? basename($_SERVER['SCRIPT_NAME'], '.php');
+
+ // Check for product configuration with pterosync module
+ if ($filename === 'configproducts' && isset($_REQUEST['module']) && $_REQUEST['module'] === 'pterosync') {
+ $url = PteroSyncInstance::get()->cssPath;
+ return '' . PHP_EOL;
+ }
+
+ // Check for service details page - let it load there as the service may be pterosync
+ if ($filename === 'clientsservices' && isset($_REQUEST['id'])) {
+ $url = PteroSyncInstance::get()->cssPath;
+ return '' . PHP_EOL;
+ }
+
+ return '';
});
add_hook('AdminAreaFooterOutput', 1, function ($params) {
+ // Only load on pterosync-related admin pages
+ $filename = $params['filename'] ?? basename($_SERVER['SCRIPT_NAME'], '.php');
+
+ // Check for product configuration with pterosync module
+ if ($filename === 'configproducts' && isset($_REQUEST['module']) && $_REQUEST['module'] === 'pterosync') {
+ $url = PteroSyncInstance::get()->jsPath;
+ $urls = '' . PHP_EOL;
+ $urls .= '';
+ return $urls;
+ }
- $url = PteroSyncInstance::get()->jsPath;
- $urls = '' . PHP_EOL;
- $urls .= '';
- return $urls;
+ // Check for service details page
+ if ($filename === 'clientsservices' && isset($_REQUEST['id'])) {
+ $url = PteroSyncInstance::get()->jsPath;
+ $urls = '' . PHP_EOL;
+ $urls .= '';
+ return $urls;
+ }
+
+ return '';
});
add_hook('ClientAreaHeadOutput', 1, function ($params) {