1

I'm trying to retrieve the settings that a user sets in a Craft 3 plugin. The method I used in Craft 2 plugins doesn't seem to work anymore. To demonstrate the problem, I'd made a plugin and uploaded it to GitHub to demonstrate it.

Basically though, when I trace out my plugin's settings, I can see the value that is custom set in the trace readout.

Craft::trace($this->settings, __METHOD__);

returns:

{s:9:"someField";s:17:"MY CUSTOM MESSAGE";s:14:"' . "\0" . '*' . "\0" . 'classSuffix";s:5:"Model";s:23:"' . "\0" . 'yii\base\Model' . "\0" . '_errors";N;s:27:"' . "\0" . 'yii\base\Model' . "\0" . '_validators";N;s:25:"' . "\0" . 'yii\base\Model' . "\0" . '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\base\Component' . "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\base\Component' . "\0" . '_behaviors";N;}')

When I try to access this value directly though, I'm only ever able to get the default value. I had expected to return the user customize value instead.

Craft::trace($this->settings->someField, __METHOD__);

returns:

Some Default

Here's a link to the full 'non-working' version of the plugin that demonstrates the issue.

https://github.com/johnfmorton/craft3settingsTestPlugin

So, my question is how can I retrieve the individual settings for my Craft 3 plugin?