As themes become more ambitious, we’ve been looking for ways to allow them to manipulate core server-side behaviour. While they will never be given the same level as control as plugins, we can provide some predefined hooks for themes to manipulate.
Introducing: theme modifiers
They are specified using the
modifiers key in your theme’s
For a 100% up-to-date list of modifiers, check the database schema at the bottom of
theme_modifier_set.rb, but here’s a quick summary of what we have so far:
serialize_topic_excerptsboolean (default false) - always include excerpts when serializing topic lists
csp_extensionsstring array - add directives to the CSP. Works the same as the old “extend_content_security_policy” theme-setting method. But remember, simple
<script> src="">tags are allowed automatically.
svg_iconsstring array - a list of icons which should be included in the icon subset
topic thumbnailsarray of dimensions - request additional resolutions in the topic thumbnail set. Note that they are generated asynchronously, so you must fall-back to the original image if your requested size is not provided. More information available in the commit message
One theme making heavy use of these new hooks is Topic List Thumbnails Theme Component - check out the code to see how it works.