<p>Little bit confused with your question, if you want to access your settings then you can do craft::$app->plugins->getPlugin('handle')->getSettings()->foo;</p>

CC BY-SA 3.0
2018-03-26T03:52:15.423Z
That worked but is very different than the 3.0 docs that I reference.
Eric Snyder
CC BY-SA 3.0
2018-03-26T05:00:23.780Z
If you are calling that method from elsewhere page then you use namespace else you will be using the one that i provided.
sailendra mangranti
CC BY-SA 3.0
2018-03-26T05:14:40.427Z
Note: this solution is the slower, performance worse one, that calls the `ns\prefix\Plugin::getInstance()->getSettings()` in the end. I suggest to download a proper IDE that handles all namespaces and includes for you and aceess the plugin directly.
Robin Schambach
CC BY-SA 3.0
2018-03-26T11:30:11.877Z
I am using Netbeans. I am editing the plugin locally and running a LAMP server on my laptop. When I test my code I refresh the page in the browser from my local machine. The code ns\prefix\Plugin::getInstance()->getSettings()->ulStateClass; or recoveryfinder\craftnav::getInstance()->getSettings()->ulStateClass; was not working from my local machine server.
Eric Snyder
CC BY-SA 3.0
2018-03-26T23:06:51.473Z
@robin-schamback I said I was using Netbeans. I suppose I should have said I was abusing Netbeans :)! What do you recommend?
Eric Snyder
CC BY-SA 3.0
2018-03-26T23:18:34.790Z
PhpStrom maybe !!!
sailendra mangranti
CC BY-SA 3.0
2018-03-26T02:38:19.367Z
2018-03-26T02:38:19.367Z
sailendra mangranti
<p>Try</p>

<pre><code>\recoveryfinder\craftnav\Craftnav::getInstance()-&gt;getSettings()-&gt;ulStateClass;
</code></pre>

<p>Assuming your main plugin file/class is Craftnav.php</p>

<p>Hope this helps :)</p>

CC BY-SA 4.0
2019-01-10T23:11:38.340Z
2019-01-10T23:11:38.340Z
Oli
<p>My plugin structure was created by <a href="https://pluginfactory.io/" rel="nofollow noreferrer">the plugin factory</a>. I have a setting called ulStateClass and I have been able to change the value of that setting in the Setting for the plug in. Looking at the <a href="https://github.com/craftcms/docs/blob/v3/en/plugin-settings.md" rel="nofollow noreferrer">3.0 Docs page</a> for settings I see the example:</p>

<pre><code>// From your main plugin class:
$foo = $this-&gt;getSettings()-&gt;foo;

// From elsewhere:
$foo = \ns\prefix\Plugin::getInstance()-&gt;getSettings()-&gt;foo;
</code></pre>

<p>My namespace is recoveryfinder\craftnav</p>

<p>In my services php file I have the following to test:</p>

<pre><code>echo \recoveryfinder\craftnav::getInstance()-&gt;getSettings()-&gt;ulStateClass;
</code></pre>

<p>I am getting the error:</p>

<blockquote>
  <p>Error Class 'recoveryfinder\craftnav' not found</p>
</blockquote>

<p>Making progress with Craft and enjoying it. I am guessing that this is a misuse or misunderstanding of namespaces? How Do I correct this?</p>

<plugin-development><craft3><settings>
Trouble accessing setting
# Trouble accessing setting

(Asked by: username_0 on 2018-03-26)

My plugin structure was created by the plugin factory. I have a setting called ulStateClass and I have been able to change the value of that setting in the Setting for the plug in. Looking at the 3.0 Docs page for settings I see the example:
// From your main plugin class:
$foo = $this->getSettings()->foo;

// From elsewhere:
$foo = \ns\prefix\Plugin::getInstance()->getSettings()->foo;

My namespace is recoveryfinder\craftnav
In my services php file I have the following to test:
echo \recoveryfinder\craftnav::getInstance()->getSettings()->ulStateClass;

I am getting the error:

Error Class 'recoveryfinder\craftnav' not found

Making progress with Craft and enjoying it. I am guessing that this is a misuse or misunderstanding of namespaces? How Do I correct this?

**Tags:** plugin-development, craft3, settings


---

## 2 answers

### Answer by username_1 on 2018-03-26. Score: 2 | Accepted answer

Little bit confused with your question, if you want to access your settings then you can do craft::$app->plugins->getPlugin('handle')->getSettings()->foo;

> **Comments:**
> **username_0**: That worked but is very different than the 3.0 docs that I reference.  
> **username_1**: If you are calling that method from elsewhere page then you use namespace else you will be using the one that i provided.  
> **username_2**: Note: this solution is the slower, performance worse one, that calls the `ns\prefix\Plugin::getInstance()->getSettings()` in the end. I suggest to download a proper IDE that handles all namespaces and includes for you and aceess the plugin directly.  
> **username_0**: I am using Netbeans. I am editing the plugin locally and running a LAMP server on my laptop. When I test my code I refresh the page in the browser from my local machine. The code ns\prefix\Plugin::getInstance()->getSettings()->ulStateClass; or recoveryfinder\craftnav::getInstance()->getSettings()->ulStateClass; was not working from my local machine server.  
> **username_0**: @robin-schamback I said I was using Netbeans. I suppose I should have said I was abusing Netbeans :)! What do you recommend?  
> **username_1**: PhpStrom maybe !!!  

---

### Answer by username_3 on 2019-01-10. Score: 1

Try
\recoveryfinder\craftnav\Craftnav::getInstance()->getSettings()->ulStateClass;

Assuming your main plugin file/class is Craftnav.php
Hope this helps :)


---

