When loading a page template, say I’ve assigned a test page template “Test” with ID “test” to a package, with the page template configuration set to contain empty HTML and CSS fields, I expect that it would attempt to load “test.php” from the active theme directory, from the “themes/{theme}/download-manager/page-templates” folder. However, the code above indicates that when it loads the page template configuration from the configuration file, instead of returning an empty string as it does with link templates, it would return the empty contents plus “<style></style>”, which then forces it to skip loading and rendering the custom PHP file, and instead all it will render is an empty page with an empty style element.
Ideally this would be changed to something like:
$add_styles = $tpl['css'] ? "<style>{$tpl['css']}</style>" : '';
This would append the style element to the content only if the CSS field has a value, regardless of whether it’s a link template or page template. Not only would the custom page template be loaded in this scenario, but the rare use case where one would create a link template with CSS would also now work.