How to get data from a Global Set in a plugin? I have a Global Set called "Settings" (handle = 'settings'); Within that I have a text field called "Address" (handle = 'address'). 

I have a function in my Plugin and I'd like to get the Address data. 

In the front-end I would write this: 



{{ settings.address }}


How can I get the same information in my plugin with PHP? 

I've got as far as this: 

$address = craft()-&gt;elements-&gt;getCriteria(ElementType::GlobalSet);


When I var_dump this array, I can see the address string. But I can't figure out how to filter down to the address correctly. 

Thanks
You can use the GlobalsService service available with craft()-&gt;globals like so:

// Get the settings global set
$settings = craft()-&gt;globals-&gt;getSetByHandle('settings');

// Access the address field
var_dump($settings-&gt;address)


Or you could use ElementCriteria as you suggested:

// Get the GlobalSet element critera
$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::GlobalSet);
// Set the handle you want
$criteria-&gt;handle = 'settings';
// Find the settings set
$settings = $criteria-&gt;first();

// Access the address field
var_dump($settings-&gt;address)


You can access all fields on the $settings variable using this synthax.

Mario