Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Config Class Reference
Inheritance diagram for Config:
ConfigInterface Config

Public Member Functions

 __construct (\Magento\Framework\App\Config $appConfig)
 
 getValue ($path)
 
 setValue ($path, $value)
 
 isSetFlag ($path)
 

Protected Attributes

 $appConfig
 

Detailed Description

Backend config accessor.

Definition at line 17 of file Config.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\Config  $appConfig)
Parameters
\Magento\Framework\App\Config$appConfig
Returns
void

Definition at line 33 of file Config.php.

34  {
35  $this->appConfig = $appConfig;
36  }

Member Function Documentation

◆ getValue()

getValue (   $path)

Retrieve config value by pathPath should looks like keys imploded by "/". For example scopes/stores/admin

Parameters
string$path
Returns
mixed @api

Implements ConfigInterface.

Definition at line 41 of file Config.php.

42  {
43  if (isset($this->data[$path])) {
44  return $this->data[$path];
45  }
46 
48  if ($path) {
49  $configPath .= '/' . $path;
50  }
51  return $this->appConfig->get(System::CONFIG_TYPE, $configPath);
52  }

◆ isSetFlag()

isSetFlag (   $path)

Retrieve config flagPath should looks like keys imploded by "/". For example scopes/stores/admin

Parameters
string$path
Returns
bool @api

Implements ConfigInterface.

Definition at line 65 of file Config.php.

66  {
68  if ($path) {
69  $configPath .= '/' . $path;
70  }
71  return (bool) $this->appConfig->get(System::CONFIG_TYPE, $configPath);
72  }

◆ setValue()

setValue (   $path,
  $value 
)

Set config value

Deprecated:
100.1.2
Parameters
string$path
mixed$value
Returns
void @api

Implements ConfigInterface.

Definition at line 57 of file Config.php.

58  {
59  $this->data[$path] = $value;
60  }
$value
Definition: gender.phtml:16

Field Documentation

◆ $appConfig

$appConfig
protected

Definition at line 22 of file Config.php.


The documentation for this class was generated from the following file: