PHP Trait Webiny\Component\StdLib\ComponentTrait

Show file Open project: Webiny/Framework

Public Methods

Method Description
appendConfig ( array | ConfigObject $config ) Append new config to the existing component config
getConfig ( ) : ConfigObject Returns the current component configuration.
setConfig ( string | array | ConfigObject $componentConfig ) Set the configuration file.

Protected Methods

Method Description
postSetConfig ( ) Callback that is called once the config is set.

Method Details

appendConfig() public static method

Append new config to the existing component config
public static appendConfig ( array | ConfigObject $config )
$config array | Webiny\Component\Config\ConfigObject

getConfig() public static method

Returns the current component configuration.
public static getConfig ( ) : ConfigObject
return Webiny\Component\Config\ConfigObject

postSetConfig() protected static method

Callback that is called once the config is set.
protected static postSetConfig ( )

setConfig() public static method

The root of your yaml config file must match the component class name, or an exception will be thrown. If you wish to define a default config, just create a static array called $defaultConfig. When setting/updating a config, it is always merged with the default config and current loaded config.
public static setConfig ( string | array | ConfigObject $componentConfig )
$componentConfig string | array | Webiny\Component\Config\ConfigObject Path to the configuration YAML file or ConfigObject instance