Using Theme Custom Form Data As Config Variable

- 1 answer

I'm trying to set up my website so changing one config value reflects in a site-wide change. The most obvious example is changing the site title.

I tried using config('constants.site_title') or something like that but it doesn't look like it can be accessed on the twig without initializing it in the php code section.

I tried using plugin's Settings as outlined in but that also was hard to access from the twig views.

Finally I found that using theme custom form data works (see Is this the right way to do it? I feel like this use case must have been encountered before and there must be a best practice for it.



Is this the right way to do it?

I think its a reasonable choice - supports most of field types including repeater, has its own "Configure customization options for the active theme" permission, and is easily accessible everywhere in Twig with {{ this.theme.<field_name> }}