Adding settings options for a plugin

(Rene Groeschke) #1

I would like to have some plugin specific settings. I looked at the discourse-tagging plugin and added a config section to my plugin (config/settings.yml + locales). But the settings do not show up on the settings page. The plugin.rb of the discourse tagging plugin calls

enabled_site_setting :tagging_enabled

but I don’t know what to make about that. Is there any kind of documentation for using plugin specific settings in my plugin? Also is it possible to have a password field in the settings?

(Mittineague) #2

Is your plugin’s config folder like this?

    settings.yml		// variable objects
      client.en.yml		// adds inputs to ACP UI
      server.en.yml		// variable values 

Sorry, I don’t know. I tried getting a textarea instead of text input but didn’t figure out how :sadpanda:

(Rene Groeschke) #3

I still can’t get that to work. my plugins config directory structure looks exactly like @Mittineague described it.

Currently settings.yml file only contains

        default: false

but when I put this in my plugin.rb file:

enabled_site_setting :jira_enabled

I get the following exception: “undefined method `jira_enabled’”

Again, I’m just trying to follow the tagging plugin to get some configuration options for my plugin

(Mittineague) #4

Unless it’s only here, it looks like your indentation is off (should be 2 spaces, not 4 or a tab)
yml is very picky about that.
Try an online validator like

(Magnetidog) #5

Mittineague - were you ever able to figure out how to add a textarea? Trying to figure out the same thing!

(Mittineague) #6

I haven’t tried it yet, but the nearest I can figure is it isn’t a simple yml thing, but needs an admin hbs template eg.

(Magnetidog) #7

Thanks so much, also for the example!

This is what I suspected (“feared”, but it is not that bad I suppose).