You are here

class AcquiaContentHubServiceProvider in Acquia Content Hub 8

Make sure it exposes the acquia_contenthub_cdf format as json.

Alters the service definition for RemovePageThemeWrapperSubscriber.

Hierarchy

Expanded class hierarchy of AcquiaContentHubServiceProvider

File

src/AcquiaContentHubServiceProvider.php, line 16

Namespace

Drupal\acquia_contenthub
View source
class AcquiaContentHubServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    if ($container
      ->has('http_middleware.negotiation') && is_a($container
      ->getDefinition('http_middleware.negotiation')
      ->getClass(), '\\Drupal\\Core\\StackMiddleware\\NegotiationMiddleware', TRUE)) {
      $container
        ->getDefinition('http_middleware.negotiation')
        ->addMethodCall('registerFormat', [
        'acquia_contenthub_cdf',
        [
          'application/json',
        ],
      ]);
    }
  }

  /**
   * {@inheritDoc}
   */
  public function register(ContainerBuilder $container) {
    parent::register($container);
    if (version_compare(\Drupal::VERSION, '9.0.0', '>=')) {
      $class_name = RemovePageThemeWrapperSubscriberD9::class;
    }
    else {
      $class_name = RemovePageThemeWrapperSubscriber::class;
    }
    $container
      ->register('acquia_contenthub.page.theme_wrapper.view_subscriber', $class_name)
      ->addArgument(new Reference('class_resolver'))
      ->addArgument(new Reference('current_route_match'))
      ->addArgument('%main_content_renderers%')
      ->addTag('event_subscriber');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AcquiaContentHubServiceProvider::alter public function Modifies existing service definitions. Overrides ServiceProviderBase::alter
AcquiaContentHubServiceProvider::register public function Registers services to the container. Overrides ServiceProviderBase::register