You are here

protected function Oauth2ClientPluginBase::loadConfiguration in OAuth2 Client 8.3

Helper function to initialize the internal configuration array.

Parameters

array $configuration: Provided configuration.

bool $save: Flags if the loaded configuration should also be saved.

2 calls to Oauth2ClientPluginBase::loadConfiguration()
Oauth2ClientPluginBase::setConfiguration in src/Plugin/Oauth2Client/Oauth2ClientPluginBase.php
Sets the configuration for this plugin instance.
Oauth2ClientPluginBase::__construct in src/Plugin/Oauth2Client/Oauth2ClientPluginBase.php
Constructs a Oauth2ClientPluginBase object.

File

src/Plugin/Oauth2Client/Oauth2ClientPluginBase.php, line 156

Class

Oauth2ClientPluginBase
Base class for Oauth2Client plugins.

Namespace

Drupal\oauth2_client\Plugin\Oauth2Client

Code

protected function loadConfiguration(array $configuration, $save = FALSE) {
  $configName = 'oauth2_client.credentials.' . $this
    ->getId();
  $config = $this
    ->config($configName);
  $savedConfig = $config
    ->getRawData();
  $this->configuration = NestedArray::mergeDeep($this
    ->defaultConfiguration(), $savedConfig, $configuration);
  if ($save) {
    foreach ($this->configuration as $key => $value) {
      $config
        ->set($key, $value);
    }
    $config
      ->save();
  }
}