SocialCoreServiceProvider.php in Open Social 10.1.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.2 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.3 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.4 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.5 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.6 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.7 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 8.8 modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 10.3.x modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 10.0.x modules/social_features/social_core/src/SocialCoreServiceProvider.php
- 10.2.x modules/social_features/social_core/src/SocialCoreServiceProvider.php
Namespace
Drupal\social_coreFile
modules/social_features/social_core/src/SocialCoreServiceProvider.phpView source
<?php
namespace Drupal\social_core;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Drupal\social_core\Service\LayoutService;
/**
* Class SocialCoreServiceProvider.
*
* @package Drupal\social_core
*/
class SocialCoreServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
// Overrides language_manager class to test domain language negotiation.
$definition = $container
->getDefinition('entity.autocomplete_matcher');
$definition
->setClass('Drupal\\social_core\\Entity\\EntityAutocompleteMatcher');
$modules = $container
->getParameter('container.modules');
// Check if select 2 is installed before we get the definition, otherwise
// you get a requested a non-existent service "select2.autocomplete_matcher
// on update hooks.
if (isset($modules['select2'])) {
$definition = $container
->getDefinition('select2.autocomplete_matcher');
$definition
->setClass('Drupal\\social_core\\Entity\\Select2EntityAutocompleteMatcher');
}
// Check for installed layout_builder module.
if (isset($modules['layout_builder'])) {
// If it's installed we can register our service, using layout_builder
// classes to check whether entities enabled layout builder.
$service_definition = new Definition(LayoutService::class);
$container
->setDefinition('social_core.layout', $service_definition);
}
}
}
Classes
Name | Description |
---|---|
SocialCoreServiceProvider | Class SocialCoreServiceProvider. |