Damus
Random Penguin · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqtx0flkxr6amckrkpzz92apurckfxgtcnzm4h747wlq72dakzmaqsn520kn I used the footer hook because I couldn't figure out how to do it with a template. The...
hypolite profile picture
@Random Penguin Let's see, you would have to write something like this:
function bookface_custom_footer(string &$body)
{
$t = Renderer::getMarkupTemplate('footer.tpl', 'addon/bookface');
$html = Renderer::replaceMacros($t, [
'$global_font' => DI::pConfig()->get($uid, 'bookface_custom', 'global_font');
...
]);
$body .= $html;
}

And then the template file itself:
<style type="text/css">:root{
{{if $global_font}}--global-font-family: {{$global_font}};{{/if}}
...
}</style>
And now it doesn't matter what people put in the global_font config value, it should be escaped in the output.
1
Random Penguin · 3w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqtx0flkxr6amckrkpzz92apurckfxgtcnzm4h747wlq72dakzmaqsn520kn Oh, so it's similar to using templates in a theme, only addon ones are appended rather than replacements? Thank you for your help! Turns out it was simpler than I thought and I was mes...