I've setup a plugin like so http://domain/admin/plugin-handle
(cp section) and a settings page here http://domain/admin/settings/plugins/plugin-handle
I can edit my plugin settings under the latter URL, however I would like non admins to be able to do so as well, but under http://domain/admin/plugin-handle
How can I go about this? Adding e.g.
{{ forms.textField({
label: 'Headline'|t('craft-terms-of-service'),
instructions: 'Enter the headline of your TOS here.'|t('craft-terms-of-service'),
id: 'tosHeadline',
name: 'tosHeadline',
value: settings['tosHeadline']})
}}
to the http://domain/admin/plugin-handle
template (src/templates/index.twig
) (cp section) non-admins have access to, I get Variable "settings" does not exist.
I can't figure out how to make it accessible/exist.
Thanks in advance
Edit
Figured out how to add fields to the cp section through the "Getting Started with Craft Plugin Development" course on craftquest.io, however the way I'm saving the settings to the db is rather crude. I'm just doing Craft::$app->db->createCommand(....
to update the plugins
table. It works, but I'm sure there are much more elegant ways of doing it?