Documentation

Config

Download (pdf)

Global Configuration

Global (site) configuration values can be directly accessed via the get() method of the global Config facade:

$value = Config::get('sitename');

Alternatively, one may grab the entire configuration object from the application:

$config = App::get('config');

$value = $config->get('sitename');

Component Configuration

Although rarer than accessing the global site configuration, sometimes it is necessary to access component-specific configurations. This can be done through the global Component facade:

$config = Component::params('com_mycomponent');

Retrieving a value from the configuration:

echo $config->get('paramName');

Plugin Configuration

A fairly common task is accessing plugin-specific configurations. This can be done by accessing the public params property on all plugins.

class plgSystemExample extends Plugin
{
    public function onDoSomething()
    {
        $config = $this->params;
    }
}

If the configuration for a specific plugin is needed from elsewhere (e.g., another extension), this can be done through the global Plugin facade. Call the params() method, passing in the type of plugin (e.g., authentication) and the name (e.g., facebook) of the plugin:

$config = Plugin::params('authentication', 'facebook');

Retrieving a value from the configuration:

echo $config->get('paramName');

Module Configuration

Module-specific configurations can be accessed via the public params property on any modules that extend the Hubzero\Module\Module class.

class Example extends Module
{
    public function display()
    {
        $config = $this->params;
    }
}

Retrieving a value from the configuration:

echo $config->get('paramName');

Last modified: