You are here

public function GetSettingsFromCoreConfig::onGetSettings in Acquia Content Hub 8.2

Extract settings from configuration and create a Settings object.

Parameters

\Drupal\acquia_contenthub\Event\AcquiaContentHubSettingsEvent $event: The dispatched event.

See also

\Acquia\ContentHubClient\Settings

File

src/EventSubscriber/GetSettings/GetSettingsFromCoreConfig.php, line 49

Class

GetSettingsFromCoreConfig
Gets the ContentHub Server settings from configuration.

Namespace

Drupal\acquia_contenthub\EventSubscriber\GetSettings

Code

public function onGetSettings(AcquiaContentHubSettingsEvent $event) {
  $config = $this->configFactory
    ->get('acquia_contenthub.admin_settings');
  $settings = new Settings($config
    ->get('client_name'), $config
    ->get('origin'), $config
    ->get('api_key'), $config
    ->get('secret_key'), $config
    ->get('hostname'), $config
    ->get('shared_secret'), $config
    ->get('webhook') ?: []);
  if ($settings) {
    $event
      ->setSettings($settings);
    $event
      ->setProvider('core_config');
    $event
      ->stopPropagation();
  }
}