Outsourcing Textsnippets

Hi there,

i am developing a template, which i want to sell to agencys and directly to customers. There are textvalues inside my code which i dont want the client to be able to change directly via the panel. For example the content of the cookieconsent. I would like to outsource those textsnippets to a file and call them in my templates. I think about storing them as config values, because i could easily change the values individual for the customer if neccessary but i am not sure if this is best practise. How do you tackle this case normaly?

I wish you all a gret weekend!

I’d go with translation variables in a plugin using the translations extension. Make more sense for a theme, I think.

Thank you! That makes sence, but is there a way to overide the values outside the plugin? If a customer has a special wish that needs to be adjusted i make all those changes outside the plugin itself. Because the plugin is the base and for an update i just replace the folder with the newest version.

In a multi-lang context, you can overwrite strings from a plugin in the language definition files.

Or, in your plugin, you define a set of defaults. Then in some file that you add wherever (maybe in /site/config) you add a file with overwrites, or you define those overwrite values in your config.

In your plugin, you check if that file exists or if there are any overwrites, and if so, you merge recursively. Then you pass this merged array to the translations extension.

Thanks, i solved it with language definition files (site/languages/de.php) and set my default values like that: {{ t('cookieconsent.accept', 'Akzeptieren') }}