7

In the main Plugin.php file of my plugin, I can retrieve the plugin's settings like this:

$this->getSettings()

How do I retrieve those same settings from elsewhere in the plugin?

I want to reference those setting from my Service.php file.

Lindsey D
  • 23,974
  • 5
  • 53
  • 110

2 Answers2

15

Try:

craft()->plugins->getPlugin('myPlugin')->getSettings()
Lindsey D
  • 23,974
  • 5
  • 53
  • 110
Ben Parizek
  • 13,448
  • 1
  • 33
  • 98
10

In addition to Ben Parizek answer, here is a full example code to get value of a "foo" setting from a "bar" plugin, using magic get methods.

$pluginSettings = craft()->plugins->getPlugin('bar')->getSettings();
$foo = $pluginSettings->foo;
Lindsey D
  • 23,974
  • 5
  • 53
  • 110
yann_yinn
  • 151
  • 8