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
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\acquia_contenthub\AcquiaContentHubServiceProvider
Expanded class hierarchy of AcquiaContentHubServiceProvider
File
- src/
AcquiaContentHubServiceProvider.php, line 16
Namespace
Drupal\acquia_contenthubView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiaContentHubServiceProvider:: |
public | function |
Modifies existing service definitions. Overrides ServiceProviderBase:: |
|
AcquiaContentHubServiceProvider:: |
public | function |
Registers services to the container. Overrides ServiceProviderBase:: |