Message of the day:
SS 4.4.0-RC1 is out. Changelog: https://github.com/silverstripe/silverstripe-framework/blob/4.4/docs/en/04_Changelogs/4.4.0.md
SilverStripe 4 related information and questions.
I register shortcodes in a dedicated class like this
That's what I thought about it being possible to have anywhere. I just popped in the controller as seemed most appropriate at the time.
it’s a static method, can be anywhere, no need to have it on controller or model class
I want to move to elemental eventually, but this is tidying up last sections before pushing live after upgrading from SS3 to SS4. One step at a time.
why not extract it into a separate class?
how do you register the shortcode?
my second thought was that it’s too long and could be split up a bit to reusable bits
I had the same thought, but let’s not push Elemental too much 😉
That looks like quite a complex solution that could more easily be solved with Elemental...
The shortcode makes it possible to define any colour for any text or image, define a link for benefits to link to, define exactly which benefits display, how many columns they display at in desktop view. It makes it possible to use the same shortcode and param format in any section of the website, no matter than background or colour requirements.