Default images styles in LocalGov Drupal
Coming from discussion on https://github.com/localgovdrupal/localgov_paragraphs/pull/125
We have been making assumptions that certain images styles will be present in the code of modules.
For example large_21_9
If someone removes this image style, that can break things.
See also https://github.com/localgovdrupal/localgov_paragraphs/issues/124
It would be good to make these configurable such that we can use preferred image styles if present, but fall back gracefully if not.
I think it would be useful to make a policy for how media styles are handled. I've not yet finished running through them but there's also like a 'News' style in the media module.
My first pass would be something like:-
- Usually make styles used in LocalGov modules configurable, but default to a generic style that is supplied by a theme module. Reasoning being they work out of the box with the theme that we ship with, the generic style means that if you change it in your site it will consistently change everywhere it is used but the naming will still make sense, and it is possible to change to a completely different style with a completely different name as suits.
- If the style is specific to a module, and should not be used anywhere else, ie a generic is not an option, then the style should be in the module itself and namespaced as such.
Theres a secondary problem which is that new modules, eg. Localgov_publications include config that is dependant on existing media display modes which could have been deleted. We need to find a way of having config that is not hard linked to image styles and media display modes. This could be
- Make the names something more generic, so it's more likely councils change the style but not delete the actual image style (Could have complexity with existing installs)
- Only include a generic image style in config, and then use an install hook to swap the image style or media display during install (could get overly complex though)
- Try to use a config filter (do they work on module installs) to allow sites to map localgov_drupal media and image styles to their custom values.