+
+ /**
+ * @brief Return relative path to theme stylesheet file
+ *
+ * Provide a sane default if nothing is chosen or the specified theme does not exist.
+ *
+ * @param string $theme Theme name
+ *
+ * @return string
+ */
+ public static function getStylesheetPath($theme)
+ {
+ $theme = Strings::sanitizeFilePathItem($theme);
+
+ if (!file_exists('view/theme/' . $theme . '/style.php')) {
+ return 'view/theme/' . $theme . '/style.css';
+ }
+
+ $a = BaseObject::getApp();
+
+ $query_params = [];
+
+ $puid = Profile::getThemeUid($a);
+ if ($puid) {
+ $query_params['puid'] = $puid;
+ }
+
+ return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
+ }