Add a configuration setting for when to load custom CSS
When debugging a Shoreditch issue with overridden fonts, we began to wonder why CiviCRM's core and custom styles are being added to every page (at least whenever civicrm_initialize()
gets called), instead of only on CiviCRM pages. A generic switch for that turned out to be non-trivial, as sometimes we do want CiviCRM styles on non-CiviCRM pages (e.g. when using profiles), sometimes we want them on public CiviCRM pages, and sometimes we don't.
This led to a POC for a configuration setting for when to load CiviCRM's custom CSS (in that special case Shoreditch's CSS), allowing administrators to choose between
- "always" (current and default behavior)
- "all CiviCRM pages"
- "all CiviCRM pages except public CiviCRM pages".
Simply adding all styles on every page may be useless on sites with more functionality than just CiviCRM. With shoreditch, that behaviour is just prone to destroying your CMS theme styles.
Patch: customCSSMode.patch
Any thoughts?