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.

15

Try:

craft()->plugins->getPlugin('myPlugin')->getSettings()
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;
  • Where the magic exists, it's worth using... Thanks! – Lindsey D Jun 29 '14 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.