You are here

class GetSettingsFromCoreSettings in Acquia Content Hub 8.2

Gets the ContentHub Server settings from Drupal's settings.

Hierarchy

  • class \Drupal\acquia_contenthub\EventSubscriber\GetSettings\GetSettingsFromCoreSettings implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of GetSettingsFromCoreSettings

1 file declares its use of GetSettingsFromCoreSettings
AcquiaContentHubSettingsCommands.php in src/Commands/AcquiaContentHubSettingsCommands.php
1 string reference to 'GetSettingsFromCoreSettings'
acquia_contenthub.services.yml in ./acquia_contenthub.services.yml
acquia_contenthub.services.yml
1 service uses GetSettingsFromCoreSettings
acquia_contenthub.settings.core in ./acquia_contenthub.services.yml
Drupal\acquia_contenthub\EventSubscriber\GetSettings\GetSettingsFromCoreSettings

File

src/EventSubscriber/GetSettings/GetSettingsFromCoreSettings.php, line 14

Namespace

Drupal\acquia_contenthub\EventSubscriber\GetSettings
View source
class GetSettingsFromCoreSettings implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[AcquiaContentHubEvents::GET_SETTINGS][] = [
      'onGetSettings',
      1000,
    ];
    return $events;
  }

  /**
   * Gets a prebuilt Settings object from Drupal's settings file.
   *
   * @param \Drupal\acquia_contenthub\Event\AcquiaContentHubSettingsEvent $event
   *   The dispatched event.
   *
   * @see \Acquia\ContentHubClient\Settings
   */
  public function onGetSettings(AcquiaContentHubSettingsEvent $event) {
    $settings = CoreSettings::get('acquia_contenthub.settings');
    if ($settings && $settings instanceof ContentHubClientSettings) {
      $event
        ->setSettings($settings);
      $event
        ->setProvider('core_settings');
      $event
        ->stopPropagation();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GetSettingsFromCoreSettings::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
GetSettingsFromCoreSettings::onGetSettings public function Gets a prebuilt Settings object from Drupal's settings file.