public function PreviewSettings::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
- modules/
acquia_contenthub_preview/ src/ EventSubscriber/ PreviewSettings.php, line 49
Class
- PreviewSettings
- Gets the ContentHub Server settings from configuration.
Namespace
Drupal\acquia_contenthub_preview\EventSubscriberCode
public function onGetSettings(AcquiaContentHubSettingsEvent $event) {
$config = $this->configFactory
->get('acquia_contenthub.admin_settings');
$hostname = 'preview-only-do-not-register';
$settings = new Settings($config
->get('client_name'), $config
->get('origin'), $config
->get('api_key'), $config
->get('secret_key'), $hostname, $config
->get('shared_secret'), $config
->get('webhook') ?? []);
if ($settings) {
$event
->setSettings($settings);
$event
->setProvider('preview_site');
$event
->stopPropagation();
}
}