Issue #1939660 by chx | catch: Use YAML as the primary means for service registration.

8.0.x
Alex Pott 2013-04-09 05:32:49 +01:00
parent 31256993e6
commit 34e630950a
75 changed files with 1110 additions and 1386 deletions

372
core/core.services.yml Normal file
View File

@ -0,0 +1,372 @@
services:
cache_factory:
class: Drupal\Core\Cache\CacheFactory
arguments: ['@settings']
calls:
- [setContainer, ['@service_container']]
cache.backend.database:
class: Drupal\Core\Cache\DatabaseBackendFactory
arguments: ['@database']
cache.backend.memory:
class: Drupal\Core\Cache\MemoryBackendFactory
cache.bootstrap:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [bootstrap]
cache.config:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [config]
cache.cache:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [cache]
cache.menu:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [menu]
cache.page:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [page]
cache.path:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [path]
config.cachedstorage.storage:
class: Drupal\Core\Config\FileStorage
factory_class: Drupal\Core\Config\FileStorageFactory
factory_method: getActive
config.storage:
class: Drupal\Core\Config\CachedStorage
arguments: ['@config.cachedstorage.storage', '@cache.config']
config.context.factory:
class: Drupal\Core\Config\Context\ConfigContextFactory
arguments: ['@event_dispatcher']
config.context:
class: Drupal\Core\Config\Context\ContextInterface
tags:
- { name: persist }
factory_method: get
factory_service: config.context.factory
config.context.free:
class: Drupal\Core\Config\Context\ContextInterface
factory_method: get
factory_service: config.context.factory
arguments: [Drupal\Core\Config\Context\FreeConfigContext]
config.factory:
class: Drupal\Core\Config\ConfigFactory
tags:
- { name: persist }
arguments: ['@config.storage', '@config.context']
config.storage.staging:
class: Drupal\Core\Config\FileStorage
factory_class: Drupal\Core\Config\FileStorageFactory
factory_method: getStaging
config.storage.snapshot:
class: Drupal\Core\Config\DatabaseStorage
arguments: ['@database', config_snapshot]
config.storage.schema:
class: Drupal\Core\Config\Schema\SchemaStorage
config.typed:
class: Drupal\Core\Config\TypedConfigManager
arguments: ['@config.storage', '@config.storage.schema']
database:
class: Drupal\Core\Database\Connection
factory_class: Drupal\Core\Database\Database
factory_method: getConnection
arguments: [default]
keyvalue:
class: Drupal\Core\KeyValueStore\KeyValueFactory
arguments: ['@service_container']
keyvalue.database:
class: Drupal\Core\KeyValueStore\KeyValueDatabaseFactory
arguments: ['@database']
keyvalue.expirable:
class: Drupal\Core\KeyValueStore\KeyValueExpirableFactory
arguments: ['@service_container']
keyvalue.expirable.database:
class: Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory
tags:
- { name: needs_destruction }
arguments: ['@database']
settings:
class: Drupal\Component\Utility\Settings
factory_class: Drupal\Component\Utility\Settings
factory_method: getSingleton
state:
class: Drupal\Core\KeyValueStore\KeyValueStoreInterface
factory_method: get
factory_service: keyvalue
arguments: [state]
queue:
class: Drupal\Core\Queue\QueueFactory
arguments: ['@settings']
calls:
- [setContainer, ['@service_container']]
queue.database:
class: Drupal\Core\Queue\QueueDatabaseFactory
arguments: ['@database']
path.alias_whitelist:
class: Drupal\Core\Path\AliasWhitelist
tags:
- { name: needs_destruction }
arguments: [path_alias_whitelist, cache, '@keyvalue', '@database']
path.alias_manager:
class: Drupal\Core\Path\AliasManager
arguments: ['@database', '@path.alias_whitelist', '@language_manager']
http_client_simpletest_subscriber:
class: Drupal\Core\Http\Plugin\SimpletestHttpRequestSubscriber
http_default_client:
class: Guzzle\Http\Client
arguments: [null, { curl.CURLOPT_TIMEOUT: 30, curl.CURLOPT_MAXREDIRS: 3 }]
calls:
- [addSubscriber, ['@http_client_simpletest_subscriber']]
- [setUserAgent, ['Drupal (+http://drupal.org/)']]
plugin.manager.entity:
class: Drupal\Core\Entity\EntityManager
arguments: ['%container.namespaces%']
request:
class: Symfony\Component\HttpFoundation\Request
event_dispatcher:
class: Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher
arguments: ['@service_container']
controller_resolver:
class: Drupal\Core\ControllerResolver
arguments: ['@service_container']
http_kernel:
class: Drupal\Core\HttpKernel
arguments: ['@event_dispatcher', '@service_container', '@controller_resolver']
language_manager:
class: Drupal\Core\Language\LanguageManager
database.slave:
class: Drupal\Core\Database\Connection
factory_class: Drupal\Core\Database\Database
factory_method: getConnection
arguments: [slave]
typed_data:
class: Drupal\Core\TypedData\TypedDataManager
calls:
- [setValidationConstraintManager, ['@validation.constraint']]
validation.constraint:
class: Drupal\Core\Validation\ConstraintManager
arguments: ['%container.namespaces%']
lock:
class: Drupal\Core\Lock\DatabaseLockBackend
user.tempstore:
class: Drupal\user\TempStoreFactory
arguments: ['@database', '@lock']
router.request_context:
class: Symfony\Component\Routing\RequestContext
calls:
- [fromRequest, ['@request']]
router.route_provider:
class: Drupal\Core\Routing\RouteProvider
arguments: ['@database']
router.matcher.final_matcher:
class: Drupal\Core\Routing\UrlMatcher
router.matcher:
class: Symfony\Cmf\Component\Routing\NestedMatcher\NestedMatcher
arguments: ['@router.route_provider']
calls:
- [setFinalMatcher, ['@router.matcher.final_matcher']]
router.generator:
class: Drupal\Core\Routing\UrlGenerator
arguments: ['@router.route_provider', '@path.alias_manager.cached']
router.dynamic:
class: Symfony\Cmf\Component\Routing\DynamicRouter
arguments: ['@router.request_context', '@router.matcher', '@router.generator']
legacy_generator:
class: Drupal\Core\Routing\NullGenerator
legacy_url_matcher:
class: Drupal\Core\LegacyUrlMatcher
legacy_router:
class: Symfony\Cmf\Component\Routing\DynamicRouter
arguments: ['@router.request_context', '@legacy_url_matcher', '@legacy_generator']
router:
class: Symfony\Cmf\Component\Routing\ChainRouter
calls:
- [setContext, ['@router.request_context']]
- [add, ['@router.dynamic']]
- [add, ['@legacy_router']]
entity.query:
class: Drupal\Core\Entity\Query\QueryFactory
arguments: ['@plugin.manager.entity']
calls:
- [setContainer, ['@service_container']]
entity.query.config:
class: Drupal\Core\Config\Entity\Query\QueryFactory
arguments: ['@config.storage']
router.dumper:
class: Drupal\Core\Routing\MatcherDumper
arguments: ['@database']
router.builder:
class: Drupal\Core\Routing\RouteBuilder
arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler']
path.alias_manager.cached:
class: Drupal\Core\CacheDecorator\AliasManagerCacheDecorator
arguments: ['@path.alias_manager', '@cache.path']
path.crud:
class: Drupal\Core\Path\Path
arguments: ['@database', '@path.alias_manager']
# The argument to the hashing service defined in services.yml, to the
# constructor of PhpassHashedPassword is the log2 number of iterations for
# password stretching.
# @todo increase by 1 every Drupal version in order to counteract increases in
# the speed and power of computers available to crack the hashes. The current
# password hashing method was introduced in Drupal 7 with a log2 count of 15.
password:
class: Drupal\Core\Password\PhpassHashedPassword
arguments: [16]
mime_type_matcher:
class: Drupal\Core\Routing\MimeTypeMatcher
tags:
- { name: route_filter }
paramconverter_manager:
class: Drupal\Core\ParamConverter\ParamConverterManager
tags:
- { name: route_enhancer }
paramconverter.entity:
class: Drupal\Core\ParamConverter\EntityConverter
tags:
- { name: paramconverter }
arguments: ['@plugin.manager.entity']
router_processor_subscriber:
class: Drupal\Core\EventSubscriber\RouteProcessorSubscriber
tags:
- { name: event_subscriber }
arguments: ['@content_negotiation']
router_listener:
class: Symfony\Component\HttpKernel\EventListener\RouterListener
tags:
- { name: event_subscriber }
arguments: ['@router']
content_negotiation:
class: Drupal\Core\ContentNegotiation
view_subscriber:
class: Drupal\Core\EventSubscriber\ViewSubscriber
tags:
- { name: event_subscriber }
arguments: ['@content_negotiation']
legacy_access_subscriber:
class: Drupal\Core\EventSubscriber\LegacyAccessSubscriber
tags:
- { name: event_subscriber }
access_manager:
class: Drupal\Core\Access\AccessManager
calls:
- [setContainer, ['@service_container']]
access_subscriber:
class: Drupal\Core\EventSubscriber\AccessSubscriber
tags:
- { name: event_subscriber }
arguments: ['@access_manager']
access_check.default:
class: Drupal\Core\Access\DefaultAccessCheck
tags:
- { name: access_check }
maintenance_mode_subscriber:
class: Drupal\Core\EventSubscriber\MaintenanceModeSubscriber
tags:
- { name: event_subscriber }
path_subscriber:
class: Drupal\Core\EventSubscriber\PathSubscriber
tags:
- { name: event_subscriber }
arguments: ['@path.alias_manager.cached', '@path_processor_manager']
legacy_request_subscriber:
class: Drupal\Core\EventSubscriber\LegacyRequestSubscriber
tags:
- { name: event_subscriber }
legacy_controller_subscriber:
class: Drupal\Core\EventSubscriber\LegacyControllerSubscriber
tags:
- { name: event_subscriber }
finish_response_subscriber:
class: Drupal\Core\EventSubscriber\FinishResponseSubscriber
tags:
- { name: event_subscriber }
arguments: ['@language_manager']
scope: request
request_close_subscriber:
class: Drupal\Core\EventSubscriber\RequestCloseSubscriber
tags:
- { name: event_subscriber }
arguments: ['@module_handler']
config_global_override_subscriber:
class: Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber
tags:
- { name: event_subscriber }
language_request_subscriber:
class: Drupal\Core\EventSubscriber\LanguageRequestSubscriber
tags:
- { name: event_subscriber }
arguments: ['@language_manager']
exception_controller:
class: Drupal\Core\ExceptionController
arguments: ['@content_negotiation']
calls:
- [setContainer, ['@service_container']]
exception_listener:
class: Symfony\Component\HttpKernel\EventListener\ExceptionListener
tags:
- { name: event_subscriber }
arguments: [['@exception_controller', execute]]
path_processor_manager:
class: Drupal\Core\PathProcessor\PathProcessorManager
path_processor_decode:
class: Drupal\Core\PathProcessor\PathProcessorDecode
tags:
- { name: path_processor_inbound, priority: 1000 }
path_processor_front:
class: Drupal\Core\PathProcessor\PathProcessorFront
tags:
- { name: path_processor_inbound, priority: 200 }
arguments: ['@config.factory']
path_processor_alias:
class: Drupal\Core\PathProcessor\PathProcessorAlias
tags:
- { name: path_processor_inbound, priority: 100 }
arguments: ['@path.alias_manager']
transliteration:
class: Drupal\Core\Transliteration\PHPTransliteration
flood:
class: Drupal\Core\Flood\DatabaseBackend
arguments: ['@database']
plugin.manager.condition:
class: Drupal\Core\Condition\ConditionManager
kernel_destruct_subscriber:
class: Drupal\Core\EventSubscriber\KernelDestructionSubscriber
tags:
- { name: event_subscriber }
calls:
- [setContainer, ['@service_container']]
ajax.subscriber:
class: Drupal\Core\Ajax\AjaxSubscriber
tags:
- { name: event_subscriber }
image.toolkit.manager:
class: Drupal\system\Plugin\ImageToolkitManager
arguments: ['%container.namespaces%']
image.toolkit:
class: Drupal\system\Plugin\ImageToolkitInterface
factory_method: getDefaultToolkit
factory_service: image.toolkit.manager

View File

@ -62,20 +62,4 @@ class CacheFactory extends ContainerAware {
return $this->container->get($service_name)->get($bin);
}
/**
* Helper to register a cache bin to the container.
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
* The container to register the cache bin on.
* @param $bin
* The cache bin to add. Do not add the cache_ prefix.
*/
public static function registerBin(ContainerBuilder $container, $bin) {
$container
->register("cache.$bin", 'Drupal\Core\Cache\CacheBackendInterface')
->setFactoryService('cache_factory')
->setFactoryMethod('get')
->addArgument($bin)
->addTag('cache.bin');
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Contains \Drupal\Core\Config\FileStorageFactory.
*/
namespace Drupal\Core\Config;
/**
* Provides a factory for creating config file storage objects.
*/
class FileStorageFactory {
/**
* Returns a FileStorage object working with the active config directory.
*
* @return \Drupal\Core\Config\FileStorage FileStorage
*/
static function getActive() {
return new FileStorage(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
}
/**
* Returns a FileStorage object working with the staging config directory.
*
* @return \Drupal\Core\Config\FileStorage FileStorage
*/
static function getStaging() {
return new FileStorage(config_get_config_directory(CONFIG_STAGING_DIRECTORY));
}
}

View File

@ -7,7 +7,6 @@
namespace Drupal\Core;
use Drupal\Core\Cache\CacheFactory;
use Drupal\Core\Cache\ListCacheBinsPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterKernelListenersPass;
use Drupal\Core\DependencyInjection\Compiler\RegisterAccessChecksPass;
@ -28,9 +27,12 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig;
/**
* Bundle class for mandatory core services.
*
* This is where Drupal core registers all of its services to the Dependency
* Injection Container. Modules wishing to register services to the container
* should extend Symfony's Bundle class directly, not this class.
* This is where Drupal core registers all of its compiler passes.
* The service definitions themselves are in core/core.services.yml with a
* few, documented exceptions (typically, install requirements).
*
* Modules wishing to register services to the container should use
* modulename.services.yml in their respective directories.
*/
class CoreBundle extends Bundle {
@ -38,280 +40,12 @@ class CoreBundle extends Bundle {
* Implements \Symfony\Component\HttpKernel\Bundle\BundleInterface::build().
*/
public function build(ContainerBuilder $container) {
$this->registerCache($container);
// Register active configuration storage.
$container
->register('config.cachedstorage.storage', 'Drupal\Core\Config\FileStorage')
->addArgument(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY));
$container
->register('config.storage', 'Drupal\Core\Config\CachedStorage')
->addArgument(new Reference('config.cachedstorage.storage'))
->addArgument(new Reference('cache.config'));
$container->register('config.context.factory', 'Drupal\Core\Config\Context\ConfigContextFactory')
->addArgument(new Reference('event_dispatcher'));
$container->register('config.context', 'Drupal\Core\Config\Context\ContextInterface')
->setFactoryService(new Reference('config.context.factory'))
->setFactoryMethod('get')
->addTag('persist');
// Register a config context with no overrides for use in administration
// forms, enabling modules and importing configuration.
$container->register('config.context.free', 'Drupal\Core\Config\Context\ContextInterface')
->setFactoryService(new Reference('config.context.factory'))
->setFactoryMethod('get')
->addArgument('Drupal\Core\Config\Context\FreeConfigContext');
$container->register('config.factory', 'Drupal\Core\Config\ConfigFactory')
->addArgument(new Reference('config.storage'))
->addArgument(new Reference('config.context'))
->addTag('persist');
// Register staging configuration storage.
$container
->register('config.storage.staging', 'Drupal\Core\Config\FileStorage')
->addArgument(config_get_config_directory(CONFIG_STAGING_DIRECTORY));
// Register import snapshot configuration storage.
$container
->register('config.storage.snapshot', 'Drupal\Core\Config\DatabaseStorage')
->addArgument(new Reference('database'))
->addArgument('config_snapshot');
// Register schema configuration storage.
$container
->register('config.storage.schema', 'Drupal\Core\Config\Schema\SchemaStorage');
// Register the typed configuration data manager.
$container->register('config.typed', 'Drupal\Core\Config\TypedConfigManager')
->addArgument(new Reference('config.storage'))
->addArgument(new Reference('config.storage.schema'));
// Register the service for the default database connection.
$container->register('database', 'Drupal\Core\Database\Connection')
->setFactoryClass('Drupal\Core\Database\Database')
->setFactoryMethod('getConnection')
->addArgument('default');
// Register the KeyValueStore factory.
$container
->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory')
->addArgument(new Reference('service_container'));
$container
->register('keyvalue.database', 'Drupal\Core\KeyValueStore\KeyValueDatabaseFactory')
->addArgument(new Reference('database'));
// Register the KeyValueStoreExpirable factory.
$container
->register('keyvalue.expirable', 'Drupal\Core\KeyValueStore\KeyValueExpirableFactory')
->addArgument(new Reference('service_container'));
$container
->register('keyvalue.expirable.database', 'Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory')
->addArgument(new Reference('database'))
->addTag('needs_destruction');
$container->register('settings', 'Drupal\Component\Utility\Settings')
->setFactoryClass('Drupal\Component\Utility\Settings')
->setFactoryMethod('getSingleton');
// Register the State k/v store as a service.
$container->register('state', 'Drupal\Core\KeyValueStore\KeyValueStoreInterface')
->setFactoryService(new Reference('keyvalue'))
->setFactoryMethod('get')
->addArgument('state');
// Register the Queue factory.
$container
->register('queue', 'Drupal\Core\Queue\QueueFactory')
->addArgument(new Reference('settings'))
->addMethodCall('setContainer', array(new Reference('service_container')));
$container
->register('queue.database', 'Drupal\Core\Queue\QueueDatabaseFactory')
->addArgument(new Reference('database'));
$container->register('path.alias_whitelist', 'Drupal\Core\Path\AliasWhitelist')
->addArgument('path_alias_whitelist')
->addArgument('cache')
->addArgument(new Reference('keyvalue'))
->addArgument(new Reference('database'))
->addTag('needs_destruction');
$container->register('path.alias_manager', 'Drupal\Core\Path\AliasManager')
->addArgument(new Reference('database'))
->addArgument(new Reference('path.alias_whitelist'))
->addArgument(new Reference('language_manager'));
$container->register('http_client_simpletest_subscriber', 'Drupal\Core\Http\Plugin\SimpletestHttpRequestSubscriber');
$container->register('http_default_client', 'Guzzle\Http\Client')
->addArgument(NULL)
->addArgument(array(
'curl.CURLOPT_TIMEOUT' => 30.0,
'curl.CURLOPT_MAXREDIRS' => 3,
))
->addMethodCall('addSubscriber', array(new Reference('http_client_simpletest_subscriber')))
->addMethodCall('setUserAgent', array('Drupal (+http://drupal.org/)'));
// Register the EntityManager.
$container->register('plugin.manager.entity', 'Drupal\Core\Entity\EntityManager')
->addArgument('%container.namespaces%');
// The 'request' scope and service enable services to depend on the Request
// object and get reconstructed when the request object changes (e.g.,
// during a subrequest).
$container->addScope(new Scope('request'));
$container->register('request', 'Symfony\Component\HttpFoundation\Request');
$container->register('event_dispatcher', 'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher')
->addArgument(new Reference('service_container'));
$container->register('controller_resolver', 'Drupal\Core\ControllerResolver')
->addArgument(new Reference('service_container'));
$this->registerModuleHandler($container);
$container->register('http_kernel', 'Drupal\Core\HttpKernel')
->addArgument(new Reference('event_dispatcher'))
->addArgument(new Reference('service_container'))
->addArgument(new Reference('controller_resolver'));
// Register the 'language_manager' service.
$container->register('language_manager', 'Drupal\Core\Language\LanguageManager');
$container->register('database.slave', 'Drupal\Core\Database\Connection')
->setFactoryClass('Drupal\Core\Database\Database')
->setFactoryMethod('getConnection')
->addArgument('slave');
$container->register('typed_data', 'Drupal\Core\TypedData\TypedDataManager')
->addMethodCall('setValidationConstraintManager', array(new Reference('validation.constraint')));
$container->register('validation.constraint', 'Drupal\Core\Validation\ConstraintManager')
->addArgument('%container.namespaces%');
// Add the user's storage for temporary, non-cache data.
$container->register('lock', 'Drupal\Core\Lock\DatabaseLockBackend');
$container->register('user.tempstore', 'Drupal\user\TempStoreFactory')
->addArgument(new Reference('database'))
->addArgument(new Reference('lock'));
$this->registerTwig($container);
$this->registerRouting($container);
// Add the entity query factories.
$container->register('entity.query', 'Drupal\Core\Entity\Query\QueryFactory')
->addArgument(new Reference('plugin.manager.entity'))
->addMethodCall('setContainer', array(new Reference('service_container')));
$container->register('entity.query.config', 'Drupal\Core\Config\Entity\Query\QueryFactory')
->addArgument(new Reference('config.storage'));
$container->register('router.dumper', 'Drupal\Core\Routing\MatcherDumper')
->addArgument(new Reference('database'));
$container->register('router.builder', 'Drupal\Core\Routing\RouteBuilder')
->addArgument(new Reference('router.dumper'))
->addArgument(new Reference('lock'))
->addArgument(new Reference('event_dispatcher'))
->addArgument(new Reference('module_handler'));
$container->register('path.alias_manager.cached', 'Drupal\Core\CacheDecorator\AliasManagerCacheDecorator')
->addArgument(new Reference('path.alias_manager'))
->addArgument(new Reference('cache.path'));
$container->register('path.crud', 'Drupal\Core\Path\Path')
->addArgument(new Reference('database'))
->addArgument(new Reference('path.alias_manager'));
// Add password hashing service. The argument to PhpassHashedPassword
// constructor is the log2 number of iterations for password stretching.
// This should increase by 1 every Drupal version in order to counteract
// increases in the speed and power of computers available to crack the
// hashes. The current password hashing method was introduced in Drupal 7
// with a log2 count of 15.
$container->register('password', 'Drupal\Core\Password\PhpassHashedPassword')
->addArgument(16);
// The following services are tagged as 'route_filter' services and are
// processed in the RegisterRouteFiltersPass compiler pass.
$container->register('mime_type_matcher', 'Drupal\Core\Routing\MimeTypeMatcher')
->addTag('route_filter');
$container->register('paramconverter_manager', 'Drupal\Core\ParamConverter\ParamConverterManager')
->addTag('route_enhancer');
$container->register('paramconverter.entity', 'Drupal\Core\ParamConverter\EntityConverter')
->addArgument(new Reference('plugin.manager.entity'))
->addTag('paramconverter');
$container->register('router_processor_subscriber', 'Drupal\Core\EventSubscriber\RouteProcessorSubscriber')
->addArgument(new Reference('content_negotiation'))
->addTag('event_subscriber');
$container->register('router_listener', 'Symfony\Component\HttpKernel\EventListener\RouterListener')
->addArgument(new Reference('router'))
->addTag('event_subscriber');
$container->register('content_negotiation', 'Drupal\Core\ContentNegotiation');
$container->register('view_subscriber', 'Drupal\Core\EventSubscriber\ViewSubscriber')
->addArgument(new Reference('content_negotiation'))
->addTag('event_subscriber');
$container->register('legacy_access_subscriber', 'Drupal\Core\EventSubscriber\LegacyAccessSubscriber')
->addTag('event_subscriber');
$container->register('access_manager', 'Drupal\Core\Access\AccessManager')
->addMethodCall('setContainer', array(new Reference('service_container')));
$container->register('access_subscriber', 'Drupal\Core\EventSubscriber\AccessSubscriber')
->addArgument(new Reference('access_manager'))
->addTag('event_subscriber');
$container->register('access_check.default', 'Drupal\Core\Access\DefaultAccessCheck')
->addTag('access_check');
$container->register('maintenance_mode_subscriber', 'Drupal\Core\EventSubscriber\MaintenanceModeSubscriber')
->addTag('event_subscriber');
$container->register('path_subscriber', 'Drupal\Core\EventSubscriber\PathSubscriber')
->addArgument(new Reference('path.alias_manager.cached'))
->addArgument(new Reference('path_processor_manager'))
->addTag('event_subscriber');
$container->register('legacy_request_subscriber', 'Drupal\Core\EventSubscriber\LegacyRequestSubscriber')
->addTag('event_subscriber');
$container->register('legacy_controller_subscriber', 'Drupal\Core\EventSubscriber\LegacyControllerSubscriber')
->addTag('event_subscriber');
$container->register('finish_response_subscriber', 'Drupal\Core\EventSubscriber\FinishResponseSubscriber')
->addArgument(new Reference('language_manager'))
->setScope('request')
->addTag('event_subscriber');
$container->register('request_close_subscriber', 'Drupal\Core\EventSubscriber\RequestCloseSubscriber')
->addArgument(new Reference('module_handler'))
->addTag('event_subscriber');
$container->register('config_global_override_subscriber', 'Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber')
->addTag('event_subscriber');
$container->register('language_request_subscriber', 'Drupal\Core\EventSubscriber\LanguageRequestSubscriber')
->addArgument(new Reference('language_manager'))
->addTag('event_subscriber');
$container->register('exception_controller', 'Drupal\Core\ExceptionController')
->addArgument(new Reference('content_negotiation'))
->addMethodCall('setContainer', array(new Reference('service_container')));
$container->register('exception_listener', 'Symfony\Component\HttpKernel\EventListener\ExceptionListener')
->addTag('event_subscriber')
->addArgument(array(new Reference('exception_controller'), 'execute'));
$this->registerPathProcessors($container);
$container
->register('transliteration', 'Drupal\Core\Transliteration\PHPTransliteration');
$container->register('flood', 'Drupal\Core\Flood\DatabaseBackend')
->addArgument(new Reference('database'));
$container->register('plugin.manager.condition', 'Drupal\Core\Condition\ConditionManager');
$container->register('kernel_destruct_subscriber', 'Drupal\Core\EventSubscriber\KernelDestructionSubscriber')
->addMethodCall('setContainer', array(new Reference('service_container')))
->addTag('event_subscriber');
// Register Ajax event subscriber.
$container->register('ajax.subscriber', 'Drupal\Core\Ajax\AjaxSubscriber')
->addTag('event_subscriber');
// Register image toolkit manager.
$container
->register('image.toolkit.manager', 'Drupal\system\Plugin\ImageToolkitManager')
->addArgument('%container.namespaces%');
// Register image toolkit.
$container
->register('image.toolkit', 'Drupal\system\Plugin\ImageToolkitInterface')
->setFactoryService('image.toolkit.manager')
->setFactoryMethod('getDefaultToolkit');
$this->registerModuleHandler($container);
$container->addCompilerPass(new RegisterMatchersPass());
$container->addCompilerPass(new RegisterRouteFiltersPass());
@ -325,10 +59,15 @@ class CoreBundle extends Bundle {
$container->addCompilerPass(new RegisterRouteEnhancersPass());
// Add a compiler pass for registering services needing destruction.
$container->addCompilerPass(new RegisterServicesForDestructionPass());
// Add the compiler pass that will process the tagged services.
$container->addCompilerPass(new RegisterPathProcessorsPass());
$container->addCompilerPass(new ListCacheBinsPass());
}
/**
* Registers the module handler.
*
* As this is different during install, it needs to stay in PHP.
*/
protected function registerModuleHandler(ContainerBuilder $container) {
// The ModuleHandler manages enabled modules and provides the ability to
@ -346,44 +85,10 @@ class CoreBundle extends Bundle {
}
}
/**
* Registers the various services for the routing system.
*
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*/
protected function registerRouting(ContainerBuilder $container) {
$container->register('router.request_context', 'Symfony\Component\Routing\RequestContext')
->addMethodCall('fromRequest', array(new Reference('request')));
$container->register('router.route_provider', 'Drupal\Core\Routing\RouteProvider')
->addArgument(new Reference('database'));
$container->register('router.matcher.final_matcher', 'Drupal\Core\Routing\UrlMatcher');
$container->register('router.matcher', 'Symfony\Cmf\Component\Routing\NestedMatcher\NestedMatcher')
->addArgument(new Reference('router.route_provider'))
->addMethodCall('setFinalMatcher', array(new Reference('router.matcher.final_matcher')));
$container->register('router.generator', 'Drupal\Core\Routing\UrlGenerator')
->addArgument(new Reference('router.route_provider'))
->addArgument(new Reference('path.alias_manager.cached'));
$container->register('router.dynamic', 'Symfony\Cmf\Component\Routing\DynamicRouter')
->addArgument(new Reference('router.request_context'))
->addArgument(new Reference('router.matcher'))
->addArgument(new Reference('router.generator'));
$container->register('legacy_generator', 'Drupal\Core\Routing\NullGenerator');
$container->register('legacy_url_matcher', 'Drupal\Core\LegacyUrlMatcher');
$container->register('legacy_router', 'Symfony\Cmf\Component\Routing\DynamicRouter')
->addArgument(new Reference('router.request_context'))
->addArgument(new Reference('legacy_url_matcher'))
->addArgument(new Reference('legacy_generator'));
$container->register('router', 'Symfony\Cmf\Component\Routing\ChainRouter')
->addMethodCall('setContext', array(new Reference('router.request_context')))
->addMethodCall('add', array(new Reference('router.dynamic')))
->addMethodCall('add', array(new Reference('legacy_router')));
}
/**
* Registers Twig services.
*
* This is used during install so it needs to stay in PHP (and static too).
*/
public static function registerTwig(ContainerBuilder $container) {
$container->register('twig.loader.filesystem', 'Twig_Loader_Filesystem')
@ -413,49 +118,4 @@ class CoreBundle extends Bundle {
->addMethodCall('addExtension', array(new Definition('Twig_Extension_Debug')));
}
/**
* Register services related to path processing.
*/
protected function registerPathProcessors(ContainerBuilder $container) {
// Register the path processor manager service.
$container->register('path_processor_manager', 'Drupal\Core\PathProcessor\PathProcessorManager');
// Register the processor that urldecodes the path.
$container->register('path_processor_decode', 'Drupal\Core\PathProcessor\PathProcessorDecode')
->addTag('path_processor_inbound', array('priority' => 1000));
// Register the processor that resolves the front page.
$container->register('path_processor_front', 'Drupal\Core\PathProcessor\PathProcessorFront')
->addArgument(new Reference('config.factory'))
->addTag('path_processor_inbound', array('priority' => 200));
// Register the alias path processor.
$container->register('path_processor_alias', 'Drupal\Core\PathProcessor\PathProcessorAlias')
->addArgument(new Reference('path.alias_manager'))
->addTag('path_processor_inbound', array('priority' => 100));
// Add the compiler pass that will process the tagged services.
$container->addCompilerPass(new RegisterPathProcessorsPass());
}
/**
* Register services related to cache.
*/
protected function registerCache(ContainerBuilder $container) {
// This factory chooses the backend service for a given bin.
$container
->register('cache_factory', 'Drupal\Core\Cache\CacheFactory')
->addArgument(new Reference('settings'))
->addMethodCall('setContainer', array(new Reference('service_container')));
// These are the core provided backend services.
$container
->register('cache.backend.database', 'Drupal\Core\Cache\DatabaseBackendFactory')
->addArgument(new Reference('database'));
$container
->register('cache.backend.memory', 'Drupal\Core\Cache\MemoryBackendFactory');
// Register a service for each bin for injecting purposes.
foreach (array('bootstrap', 'config', 'cache', 'menu', 'page', 'path') as $bin) {
CacheFactory::registerBin($container, $bin);
}
$container->addCompilerPass(new ListCacheBinsPass());
}
}

View File

@ -0,0 +1,255 @@
<?php
/**
* @file
* Contains \Drupal\Core\DependencyInjection\YamlFileLoader.
*/
namespace Drupal\Core\DependencyInjection;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Yaml\Parser;
/**
* YamlFileLoader loads YAML files service definitions.
*
* Drupal does not use Symfony's Config component, so this is a partial copy
* of \Symfony\Component\DependencyInjection\Loader\YamlFileLoader class not
* depending on the Config component.
*/
class YamlFileLoader {
/**
* @param \Drupal\Core\DependencyInjection\ContainerBuilder $container
*/
protected $container;
public function __construct(ContainerBuilder $container) {
$this->container = $container;
}
/**
* Load a YAML file containing service definitions and kernel parameters.
*
* string $filename
* The name of the file to load.
*/
public function load($filename) {
$content = $this->loadFile($filename);
$content += array('parameters' => array(), 'services' => array());
// parameters
foreach ($content['parameters'] as $key => $value) {
$this->container->setParameter($key, $this->resolveServices($value));
}
// services
foreach ($content['services'] as $id => $service) {
$this->parseDefinition($id, $service, $filename);
}
}
/**
* Parses a definition.
*
* Copied from \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseDefinition().
*
* @param string $id
* The id of the service.
* @param string|array $service
* Either a string starting with a @ meaning this service is an alias or
* the array defining the service.
* @param string $filename
* The name of the file, only used in error messages.
*
* @throws \InvalidArgumentException When tags are invalid
*/
protected function parseDefinition($id, $service, $filename) {
if (is_string($service) && 0 === strpos($service, '@')) {
$this->container->setAlias($id, substr($service, 1));
return;
}
elseif (isset($service['alias'])) {
$public = !array_key_exists('public', $service) || (Boolean) $service['public'];
$this->container->setAlias($id, new Alias($service['alias'], $public));
return;
}
if (isset($service['parent'])) {
$definition = new DefinitionDecorator($service['parent']);
}
else {
$definition = new Definition();
}
if (isset($service['class'])) {
$definition->setClass($service['class']);
}
if (isset($service['scope'])) {
$definition->setScope($service['scope']);
}
if (isset($service['synthetic'])) {
$definition->setSynthetic($service['synthetic']);
}
if (isset($service['public'])) {
$definition->setPublic($service['public']);
}
if (isset($service['abstract'])) {
$definition->setAbstract($service['abstract']);
}
if (isset($service['factory_class'])) {
$definition->setFactoryClass($service['factory_class']);
}
if (isset($service['factory_method'])) {
$definition->setFactoryMethod($service['factory_method']);
}
if (isset($service['factory_service'])) {
$definition->setFactoryService($service['factory_service']);
}
if (isset($service['file'])) {
$definition->setFile($service['file']);
}
if (isset($service['arguments'])) {
$definition->setArguments($this->resolveServices($service['arguments']));
}
if (isset($service['properties'])) {
$definition->setProperties($this->resolveServices($service['properties']));
}
if (isset($service['configurator'])) {
if (is_string($service['configurator'])) {
$definition->setConfigurator($service['configurator']);
}
else {
$definition->setConfigurator(array($this->resolveServices($service['configurator'][0]), $service['configurator'][1]));
}
}
if (isset($service['calls'])) {
foreach ($service['calls'] as $call) {
$args = isset($call[1]) ? $this->resolveServices($call[1]) : array();
$definition->addMethodCall($call[0], $args);
}
}
if (isset($service['tags'])) {
if (!is_array($service['tags'])) {
throw new \InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s.', $id, $filename));
}
foreach ($service['tags'] as $tag) {
if (!isset($tag['name'])) {
throw new \InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $filename));
}
$name = $tag['name'];
unset($tag['name']);
foreach ($tag as $value) {
if (!is_scalar($value)) {
throw new \InvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s" in %s.', $id, $name, $filename));
}
}
$definition->addTag($name, $tag);
}
}
$this->container->setDefinition($id, $definition);
}
/**
* Loads a YAML file.
*
* @param string $filename
*
* @return array
* The file content.
*/
protected function loadFile($filename) {
$parser = new Parser();
return $this->validate($parser->parse(file_get_contents($filename)), $filename);
}
/**
* Validates a YAML file.
*
* @param mixed $content
* The parsed YAML file.
* @param string $filename
* The name of the file, only used for error messages.
*
* @return array
* The $content unchanged returned to allow for chaining this method.
*
* @throws \InvalidArgumentException When service file is not valid
*/
protected function validate($content, $filename) {
if (NULL === $content) {
return $content;
}
if (!is_array($content)) {
throw new \InvalidArgumentException(sprintf('The service file "%s" is not valid: it is not an array.', $filename));
}
if ($keys = array_diff_key($content, array('parameters' => TRUE, 'services' => TRUE))) {
$invalid_keys = htmlspecialchars(implode(', ', $keys), ENT_QUOTES, 'UTF-8');
throw new \InvalidArgumentException(sprintf('The service file "%s" is not valid: it contains invalid keys %s.', $filename, $invalid_keys));
}
return $content;
}
/**
* Resolves services.
*
* Copied from \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseDefinition().
*
* @param mixed $value
* If a string, then it is either a plain string (for example a class
* name) or a reference to a service. If it's an array then it's a list of
* such strings.
*
* @return string|\Symfony\Component\DependencyInjection\Reference
* Either the string unchanged or the Reference object.
*/
protected function resolveServices($value) {
if (is_array($value)) {
$value = array_map(array($this, 'resolveServices'), $value);
}
elseif (is_string($value) && 0 === strpos($value, '@')) {
if (0 === strpos($value, '@?')) {
$value = substr($value, 2);
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
}
else {
$value = substr($value, 1);
$invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
}
if ('=' === substr($value, -1)) {
$value = substr($value, 0, -1);
$strict = FALSE;
}
else {
$strict = TRUE;
}
$value = new Reference($value, $invalidBehavior, $strict);
}
return $value;
}
}

View File

@ -11,6 +11,7 @@ use Drupal\Component\PhpStorage\PhpStorageFactory;
use Drupal\Core\Config\BootstrapConfigStorageFactory;
use Drupal\Core\CoreBundle;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\YamlFileLoader;
use Symfony\Component\ClassLoader\ClassLoader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@ -99,6 +100,13 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
*/
protected $containerNeedsDumping;
/**
* Holds the list of YAML files containing service definitions.
*
* @var array
*/
protected $serviceYamls;
/**
* Constructs a DrupalKernel object.
*
@ -160,6 +168,9 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
$bundles = array(
new CoreBundle(),
);
$this->serviceYamls = array(
'core/core.services.yml'
);
$this->bundleClasses = array('Drupal\Core\CoreBundle');
// Ensure we know what modules are enabled and that their namespaces are
@ -168,7 +179,8 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
$module_list = $this->configStorage->read('system.module');
$this->moduleList = isset($module_list['enabled']) ? $module_list['enabled'] : array();
}
$this->registerNamespaces($this->getModuleNamespaces($this->getModuleFileNames()));
$module_filenames = $this->getModuleFileNames();
$this->registerNamespaces($this->getModuleNamespaces($module_filenames));
// Load each module's bundle class.
foreach ($this->moduleList as $module => $weight) {
@ -178,6 +190,10 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
$bundles[] = new $class();
$this->bundleClasses[] = $class;
}
$filename = dirname($module_filenames[$module]) . "/$module.services.yml";
if (file_exists($filename)) {
$this->serviceYamls[] = $filename;
}
}
// Add site specific or test bundles.
@ -187,6 +203,10 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
$this->bundleClasses[] = $class;
}
}
// Add site specific or test YAMLs.
if (!empty($GLOBALS['conf']['container_yamls'])) {
$this->serviceYamls = array_merge($this->serviceYamls, $GLOBALS['conf']['container_yamls']);
}
return $bundles;
}
@ -379,6 +399,10 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
$container->register('class_loader', 'Symfony\Component\ClassLoader\ClassLoader')->setSynthetic(TRUE);
$container->register('kernel', 'Symfony\Component\HttpKernel\KernelInterface')->setSynthetic(TRUE);
$container->register('service_container', 'Symfony\Component\DependencyInjection\ContainerInterface')->setSynthetic(TRUE);
$yaml_loader = new YamlFileLoader($container);
foreach ($this->serviceYamls as $filename) {
$yaml_loader->load($filename);
}
foreach ($this->bundles as $bundle) {
$bundle->build($container);
}

View File

@ -0,0 +1,10 @@
services:
plugin.manager.aggregator.fetcher:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [fetcher, '%container.namespaces%']
plugin.manager.aggregator.parser:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [parser, '%container.namespaces%']
plugin.manager.aggregator.processor:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [processor, '%container.namespaces%']

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\aggregator\AggregatorBundle.
*/
namespace Drupal\aggregator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Registers aggregator module's services to the container.
*/
class AggregatorBundle extends Bundle {
/**
* Overrides Bundle::build().
*/
public function build(ContainerBuilder $container) {
foreach (array('fetcher', 'parser', 'processor') as $type) {
$container->register("plugin.manager.aggregator.$type", 'Drupal\aggregator\Plugin\AggregatorPluginManager')
->addArgument($type)
->addArgument('%container.namespaces%');
}
}
}

View File

@ -0,0 +1,9 @@
services:
ban.ip_manager:
class: Drupal\ban\BanIpManager
arguments: ['@database']
ban.subscriber:
class: Drupal\ban\EventSubscriber\BanSubscriber
tags:
- { name: event_subscriber }
arguments: ['@ban.ip_manager']

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\ban\BanBundle.
*/
namespace Drupal\ban;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Defines the Ban bundle.
*/
class BanBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('ban.ip_manager', 'Drupal\ban\BanIpManager')
->addArgument(new Reference('database'));
$container->register('ban.subscriber', 'Drupal\ban\EventSubscriber\BanSubscriber')
->addArgument(new Reference('ban.ip_manager'))
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,11 @@
services:
plugin.manager.block:
class: Drupal\block\Plugin\Type\BlockManager
arguments: ['%container.namespaces%']
cache.block:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [block]

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\block\BlockBundle.
*/
namespace Drupal\Block;
use Drupal\Core\Cache\CacheFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Provides the block dependency injection container.
*/
class BlockBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the BlockManager class with the dependency injection container.
$container->register('plugin.manager.block', 'Drupal\block\Plugin\Type\BlockManager')
->addArgument('%container.namespaces%');
CacheFactory::registerBin($container, 'block');
}
}

View File

@ -0,0 +1,4 @@
services:
plugin.manager.ckeditor.plugin:
class: Drupal\ckeditor\CKEditorPluginManager
arguments: ['%container.namespaces%']

View File

@ -1,27 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\ckeditor\CKEditorBundle.
*/
namespace Drupal\ckeditor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* CKEditor dependency injection container.
*/
class CKEditorBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('plugin.manager.ckeditor.plugin', 'Drupal\ckeditor\CKEditorPluginManager')
->addArgument('%container.namespaces%');
}
}

View File

@ -0,0 +1,14 @@
services:
plugin.manager.edit.editor:
class: Drupal\edit\Plugin\EditorManager
arguments: ['%container.namespaces%']
access_check.edit.entity_field:
class: Drupal\edit\Access\EditEntityFieldAccessCheck
tags:
- { name: access_check }
edit.editor.selector:
class: Drupal\edit\EditorSelector
arguments: ['@plugin.manager.edit.editor']
edit.metadata.generator:
class: Drupal\edit\MetadataGenerator
arguments: ['@access_check.edit.entity_field', '@edit.editor.selector', '@plugin.manager.edit.editor']

View File

@ -1,38 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\edit\EditBundle.
*/
namespace Drupal\edit;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Edit dependency injection container.
*/
class EditBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('plugin.manager.edit.editor', 'Drupal\edit\Plugin\EditorManager')
->addArgument('%container.namespaces%');
$container->register('access_check.edit.entity_field', 'Drupal\edit\Access\EditEntityFieldAccessCheck')
->addTag('access_check');
$container->register('edit.editor.selector', 'Drupal\edit\EditorSelector')
->addArgument(new Reference('plugin.manager.edit.editor'));
$container->register('edit.metadata.generator', 'Drupal\edit\MetadataGenerator')
->addArgument(new Reference('access_check.edit.entity_field'))
->addArgument(new Reference('edit.editor.selector'))
->addArgument(new Reference('plugin.manager.edit.editor'));
}
}

View File

@ -0,0 +1,4 @@
services:
plugin.manager.editor:
class: Drupal\editor\Plugin\EditorManager
arguments: ['%container.namespaces%']

View File

@ -1,28 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\editor\EditorBundle.
*/
namespace Drupal\editor;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Editor dependency injection container.
*/
class EditorBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the plugin manager for our plugin type with the dependency
// injection container.
$container->register('plugin.manager.editor', 'Drupal\editor\Plugin\EditorManager')
->addArgument('%container.namespaces%');
}
}

View File

@ -0,0 +1,7 @@
services:
plugin.manager.entity_reference.selection:
class: Drupal\entity_reference\Plugin\Type\SelectionPluginManager
arguments: ['%container.namespaces%']
entity_reference.autocomplete:
class: Drupal\entity_reference\EntityReferenceAutocomplete
arguments: ['@plugin.manager.entity']

View File

@ -1,30 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\entity_reference\EntityReferenceBundle.
*/
namespace Drupal\entity_reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Entity Reference dependency injection container.
*/
class EntityReferenceBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the SelectionPluginManager class and the autocomplete helper
// with the dependency injection container.
$container->register('plugin.manager.entity_reference.selection', 'Drupal\entity_reference\Plugin\Type\SelectionPluginManager')
->addArgument('%container.namespaces%');
$container->register('entity_reference.autocomplete', 'Drupal\entity_reference\EntityReferenceAutocomplete')
->addArgument(new Reference('plugin.manager.entity'));
}
}

View File

@ -0,0 +1,14 @@
services:
plugin.manager.field.widget:
class: Drupal\field\Plugin\Type\Widget\WidgetPluginManager
arguments: ['%container.namespaces%']
plugin.manager.field.formatter:
class: Drupal\field\Plugin\Type\Formatter\FormatterPluginManager
arguments: ['%container.namespaces%']
cache.field:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [field]

View File

@ -1,31 +0,0 @@
<?php
/**
* @file
* Contains Drupal\field\FieldBundle.
*/
namespace Drupal\field;
use Drupal\Core\Cache\CacheFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Field dependency injection container.
*/
class FieldBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the plugin managers for our plugin types with the dependency injection container.
$container->register('plugin.manager.field.widget', 'Drupal\field\Plugin\Type\Widget\WidgetPluginManager')
->addArgument('%container.namespaces%');
$container->register('plugin.manager.field.formatter', 'Drupal\field\Plugin\Type\Formatter\FormatterPluginManager')
->addArgument('%container.namespaces%');
CacheFactory::registerBin($container, 'field');
}
}

View File

@ -0,0 +1,4 @@
services:
entity.query.field_sql_storage:
class: Drupal\field_sql_storage\Entity\QueryFactory
arguments: ['@database']

View File

@ -1,22 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\field_sql_storage\FieldSqlStorageBundle.
*/
namespace Drupal\field_sql_storage;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class FieldSqlStorageBundle extends Bundle {
public function build(ContainerBuilder $container) {
$container
->register('entity.query.field_sql_storage', 'Drupal\field_sql_storage\Entity\QueryFactory')
->addArgument(new Reference('database'));
}
}

View File

@ -0,0 +1,4 @@
services:
file.usage:
class: Drupal\file\FileUsage\DatabaseFileUsageBackend
arguments: ['@database']

View File

@ -1,19 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\file\FileBundle.
*/
namespace Drupal\file;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class FileBundle extends Bundle {
public function build(ContainerBuilder $container) {
$container->register('file.usage', 'Drupal\file\FileUsage\DatabaseFileUsageBackend')
->addArgument(new Reference('database'));
}
}

View File

@ -0,0 +1,12 @@
services:
cache.filter:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [filter]
access_check.filter_disable:
class: Drupal\filter\Access\FormatDisableCheck
tags:
- { name: access_check }

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\filter\FilterBundle.
*/
namespace Drupal\filter;
use Drupal\Core\Cache\CacheFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Registers filter module's services to the container.
*/
class FilterBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
CacheFactory::registerBin($container, 'filter');
$container->register('access_check.filter_disable', 'Drupal\filter\Access\FormatDisableCheck')
->addTag('access_check');
}
}

View File

@ -0,0 +1,33 @@
services:
serializer.normalizer.entity_reference_item.hal:
class: Drupal\hal\Normalizer\EntityReferenceItemNormalizer
tags:
- { name: normalizer, priority: 10 }
calls:
- [setLinkManager, ['@rest.link_manager']]
serializer.normalizer.field_item.hal:
class: Drupal\hal\Normalizer\FieldItemNormalizer
tags:
- { name: normalizer, priority: 10 }
calls:
- [setLinkManager, ['@rest.link_manager']]
serializer.normalizer.field.hal:
class: Drupal\hal\Normalizer\FieldNormalizer
tags:
- { name: normalizer, priority: 10 }
calls:
- [setLinkManager, ['@rest.link_manager']]
serializer.normalizer.entity.hal:
class: Drupal\hal\Normalizer\EntityNormalizer
tags:
- { name: normalizer, priority: 10 }
calls:
- [setLinkManager, ['@rest.link_manager']]
serializer.encoder.hal:
class: Drupal\hal\Encoder\JsonEncoder
tags:
- { name: encoder, priority: 10, format: hal_json }
hal.subscriber:
class: Drupal\hal\HalSubscriber
tags:
- { name: event_subscriber }

View File

@ -1,49 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\hal\HalBundle.
*/
namespace Drupal\hal;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* HAL dependency injection container.
*/
class HalBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$priority = 10;
$container->register('serializer.normalizer.entity_reference_item.hal', 'Drupal\hal\Normalizer\EntityReferenceItemNormalizer')
->addMethodCall('setLinkManager', array(new Reference('rest.link_manager')))
->addTag('normalizer', array('priority' => $priority));
$container->register('serializer.normalizer.field_item.hal', 'Drupal\hal\Normalizer\FieldItemNormalizer')
->addMethodCall('setLinkManager', array(new Reference('rest.link_manager')))
->addTag('normalizer', array('priority' => $priority));
$container->register('serializer.normalizer.field.hal', 'Drupal\hal\Normalizer\FieldNormalizer')
->addMethodCall('setLinkManager', array(new Reference('rest.link_manager')))
->addTag('normalizer', array('priority' => $priority));
$container->register('serializer.normalizer.entity.hal', 'Drupal\hal\Normalizer\EntityNormalizer')
->addMethodCall('setLinkManager', array(new Reference('rest.link_manager')))
->addTag('normalizer', array('priority' => $priority));
$container->register('serializer.encoder.hal', 'Drupal\hal\Encoder\JsonEncoder')
->addTag('encoder', array(
'priority' => $priority,
'format' => array(
'hal_json' => 'HAL (JSON)',
),
));
$container->register('hal.subscriber', 'Drupal\hal\HalSubscriber')
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,39 @@
# Normalizers can be specified to support a particular class and format in
# Normalizer::supportsNormalization(). Since the first matching Normalizer
# is used, Normalizers should be ordered from most specific to least
# specific.
services:
serializer.normalizer.entity_reference.jsonld:
class: Drupal\jsonld\JsonldEntityReferenceNormalizer
tags:
- { name: normalizer, priority: 5 }
arguments: ['@rdf.site_schema_manager', '@rdf.mapping_manager']
serializer.normalizer.field_item.jsonld:
class: Drupal\jsonld\JsonldFieldItemNormalizer
tags:
- { name: normalizer, priority: 5 }
arguments: ['@rdf.site_schema_manager', '@rdf.mapping_manager']
serializer.normalizer.entity.jsonld:
class: Drupal\jsonld\JsonldEntityNormalizer
tags:
- { name: normalizer, priority: 5 }
arguments: ['@rdf.site_schema_manager', '@rdf.mapping_manager']
serializer.normalizer.rdf_schema.jsonld:
class: Drupal\jsonld\JsonldRdfSchemaNormalizer
tags:
- { name: normalizer, priority: 5 }
arguments: ['@rdf.site_schema_manager', '@rdf.mapping_manager']
# Add the encoder to the service container. Encoders can only specify which
# format they support in Encoder::supportsEncoding().
serializer.encoder.jsonld:
class: Drupal\jsonld\JsonldEncoder
tags:
- { name: encoder, priority: 5, format: jsonld }
serializer.encoder.drupal_jsonld:
class: Drupal\jsonld\JsonldEncoder
tags:
- { name: encoder, priority: 5, format: drupal_jsonld }
jsonld.subscriber:
class: Drupal\jsonld\EventSubscriber\JsonldSubscriber
tags:
- { name: event_subscriber }

View File

@ -1,72 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\jsonld\JsonldBundle.
*/
namespace Drupal\jsonld;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\Serializer\Serializer;
/**
* Jsonld dependency injection container.
*/
class JsonldBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$priority = 5;
// Normalizers can be specified to support a particular class and format in
// Normalizer::supportsNormalization(). Since the first matching Normalizer
// is used, Normalizers should be ordered from most specific to least
// specific.
$normalizers = array(
// Field Item.
'entity_reference' => array(
'jsonld' => 'Drupal\jsonld\JsonldEntityReferenceNormalizer',
),
'field_item' => array(
'jsonld' => 'Drupal\jsonld\JsonldFieldItemNormalizer',
),
// Entity.
'entity' => array(
'jsonld' => 'Drupal\jsonld\JsonldEntityNormalizer',
),
// RDF Schema.
'rdf_schema' => array(
'jsonld' => 'Drupal\jsonld\JsonldRdfSchemaNormalizer',
),
);
// Add Normalizers to service container.
foreach ($normalizers as $supported_class => $formats) {
foreach ($formats as $format => $normalizer_class) {
$container->register("serializer.normalizer.{$supported_class}.{$format}", $normalizer_class)
->addArgument(new Reference('rdf.site_schema_manager'))
->addArgument(new Reference('rdf.mapping_manager'))
->addTag('normalizer', array('priority' => $priority));
}
}
// Add the encoder to the service container. Encoders can only specify which
// format they support in Encoder::supportsEncoding().
$container->register('serializer.encoder.jsonld', 'Drupal\jsonld\JsonldEncoder')
->addTag('encoder', array(
'priority' => $priority,
'format' => array(
'jsonld' => 'JSON-LD',
'drupal_jsonld' => 'Drupal JSON-LD',
),
));
$container->register('jsonld.subscriber', 'Drupal\jsonld\EventSubscriber\JsonldSubscriber')
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,6 @@
services:
path_processor_language:
class: Drupal\language\HttpKernel\PathProcessorLanguage
tags:
- { name: path_processor_inbound, priority: 300 }
arguments: ['@module_handler']

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\language\LanguageBundle.
*/
namespace Drupal\language;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Reference;
/**
* language dependency injection container.
*/
class LanguageBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the language-based path processor.
$container->register('path_processor_language', 'Drupal\language\HttpKernel\PathProcessorLanguage')
->addArgument(new Reference('module_handler'))
->addTag('path_processor_inbound', array('priority' => 300));
}
}

View File

@ -0,0 +1,4 @@
services:
plugin.manager.layout:
class: Drupal\layout\Plugin\Type\LayoutManager
arguments: ['%container.namespaces%']

View File

@ -1,26 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\layout\LayoutBundle.
*/
namespace Drupal\Layout;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Layout dependency injection container.
*/
class LayoutBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the LayoutManager class with the dependency injection container.
$container->register('plugin.manager.layout', 'Drupal\layout\Plugin\Type\LayoutManager')
->addArgument('%container.namespaces%');
}
}

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\locale\LocaleBundle.
*/
namespace Drupal\locale;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Registers locale module's services to the container.
*/
class LocaleBundle extends Bundle {
/**
* Implements \Symfony\Component\HttpKernel\Bundle\BundleInterface::build().
*/
public function build(ContainerBuilder $container) {
$container->register('locale_config_subscriber', 'Drupal\locale\LocaleConfigSubscriber')
->addArgument(new Reference('language_manager'))
->addArgument(new Reference('config.context'))
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,6 @@
services:
locale_config_subscriber:
class: Drupal\locale\LocaleConfigSubscriber
tags:
- { name: event_subscriber }
arguments: ['@language_manager', '@config.context']

View File

@ -1,39 +0,0 @@
<?php
/**
* @file
* Contains RdfBundle.
*/
namespace Drupal\rdf;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* RDF dependency injection container.
*/
class RdfBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Site schema manager service.
$container->register('rdf.site_schema_manager', 'Drupal\rdf\SiteSchema\SiteSchemaManager')
->addArgument(new Reference('cache.cache'));
// Mapping manager service.
$container->register('rdf.mapping_manager', 'Drupal\rdf\RdfMappingManager')
->addArgument(new Reference('event_dispatcher'))
->addArgument(new Reference('rdf.site_schema_manager'));
// Mapping subscriber.
$container->register('rdf.mapping', 'Drupal\rdf\EventSubscriber\MappingSubscriber')
->addTag('event_subscriber');
// Route subscriber.
$container->register('rdf.route_subscriber', 'Drupal\rdf\EventSubscriber\RouteSubscriber')
->addArgument(new Reference('rdf.site_schema_manager'))
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,16 @@
services:
rdf.site_schema_manager:
class: Drupal\rdf\SiteSchema\SiteSchemaManager
arguments: ['@cache.cache']
rdf.mapping_manager:
class: Drupal\rdf\RdfMappingManager
arguments: ['@event_dispatcher', '@rdf.site_schema_manager']
rdf.mapping:
class: Drupal\rdf\EventSubscriber\MappingSubscriber
tags:
- { name: event_subscriber }
rdf.route_subscriber:
class: Drupal\rdf\EventSubscriber\RouteSubscriber
tags:
- { name: event_subscriber }
arguments: ['@rdf.site_schema_manager']

View File

@ -1,27 +0,0 @@
<?php
/**
* @file
* Contains RdfTestMappingBundle.
*/
namespace Drupal\rdf_test_mapping;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* RDF dependency injection container.
*/
class RdfTestMappingBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Mapping subscriber.
$container->register('rdf_test_mapping.mapping', 'Drupal\rdf_test_mapping\EventSubscriber\TestMappingSubscriber')
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,5 @@
services:
rdf_test_mapping.mapping:
class: Drupal\rdf_test_mapping\EventSubscriber\TestMappingSubscriber
tags:
- { name: event_subscriber }

View File

@ -69,7 +69,7 @@ abstract class ResourceBase extends PluginBase implements ResourceInterface {
// Restrict GET and HEAD requests to the media type specified in the
// HTTP Accept headers.
$formats = drupal_container()->getParameter('serializer.formats');
foreach ($formats as $format_name => $label) {
foreach ($formats as $format_name) {
// Expose one route per available format.
//$format_route = new Route($route->getPattern(), $route->getDefaults(), $route->getRequirements());
$format_route = clone $route;

View File

@ -1,43 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\rest\RestBundle.
*/
namespace Drupal\rest;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Rest dependency injection container.
*/
class RestBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the resource manager class with the dependency injection
// container.
$container->register('plugin.manager.rest', 'Drupal\rest\Plugin\Type\ResourcePluginManager')
->addArgument('%container.namespaces%');
$container->register('rest.route_subscriber', 'Drupal\rest\EventSubscriber\RouteSubscriber')
->addArgument(new Reference('plugin.manager.rest'))
->addArgument(new Reference('config.factory'))
->addTag('event_subscriber');
$container->register('access_check.rest.csrf', 'Drupal\rest\Access\CSRFAccessCheck')
->addTag('access_check');
$container->register('rest.link_manager', 'Drupal\rest\LinkManager\LinkManager')
->addArgument(new Reference('rest.link_manager.type'))
->addArgument(new Reference('rest.link_manager.relation'));
$container->register('rest.link_manager.type', 'Drupal\rest\LinkManager\TypeLinkManager')
->addArgument(new Reference('cache.cache'));
$container->register('rest.link_manager.relation', 'Drupal\rest\LinkManager\RelationLinkManager');
}
}

View File

@ -0,0 +1,21 @@
services:
plugin.manager.rest:
class: Drupal\rest\Plugin\Type\ResourcePluginManager
arguments: ['%container.namespaces%']
rest.route_subscriber:
class: Drupal\rest\EventSubscriber\RouteSubscriber
tags:
- { name: event_subscriber }
arguments: ['@plugin.manager.rest', '@config.factory']
access_check.rest.csrf:
class: Drupal\rest\Access\CSRFAccessCheck
tags:
- { name: access_check }
rest.link_manager:
class: Drupal\rest\LinkManager\LinkManager
arguments: ['@rest.link_manager.type', '@rest.link_manager.relation']
rest.link_manager.type:
class: Drupal\rest\LinkManager\TypeLinkManager
arguments: ['@cache.cache']
rest.link_manager.relation:
class: Drupal\rest\LinkManager\RelationLinkManager

View File

@ -46,9 +46,7 @@ class RegisterSerializationClassesCompilerPass implements CompilerPassInterface
// Find all serialization formats known.
$formats = array();
foreach ($container->findTaggedServiceIds('encoder') as $id => $attributes) {
foreach ($attributes[0]['format'] as $name => $label) {
$formats[$name] = $label;
}
$formats[] = $attributes[0]['format'];
}
$container->setParameter('serializer.formats', $formats);
}

View File

@ -19,20 +19,6 @@ class SerializationBundle extends Bundle {
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Add Serializer with arguments to be replaced in the compiler pass.
$container->register('serializer', 'Symfony\Component\Serializer\Serializer')
->addArgument(array())
->addArgument(array());
$container->register('serializer.normalizer.complex_data', 'Drupal\serialization\Normalizer\ComplexDataNormalizer')->addTag('normalizer');
$container->register('serializer.normalizer.list', 'Drupal\serialization\Normalizer\ListNormalizer')->addTag('normalizer');
$container->register('serializer.normalizer.typed_data', 'Drupal\serialization\Normalizer\TypedDataNormalizer')->addTag('normalizer');
$container->register('serializer.encoder.json', 'Drupal\serialization\Encoder\JsonEncoder')
->addTag('encoder', array('format' => array('json' => 'JSON')));
$container->register('serializer.encoder.xml', 'Drupal\serialization\Encoder\XmlEncoder')
->addTag('encoder', array('format' => array('xml' => 'XML')));
// Add a compiler pass for adding Normalizers and Encoders to Serializer.
$container->addCompilerPass(new RegisterSerializationClassesCompilerPass());
}

View File

@ -0,0 +1,24 @@
services:
serializer:
class: Symfony\Component\Serializer\Serializer
arguments: [{ }, { }]
serializer.normalizer.complex_data:
class: Drupal\serialization\Normalizer\ComplexDataNormalizer
tags:
- { name: normalizer }
serializer.normalizer.list:
class: Drupal\serialization\Normalizer\ListNormalizer
tags:
- { name: normalizer }
serializer.normalizer.typed_data:
class: Drupal\serialization\Normalizer\TypedDataNormalizer
tags:
- { name: normalizer }
serializer.encoder.json:
class: Drupal\serialization\Encoder\JsonEncoder
tags:
- { name: encoder, format: json }
serializer.encoder.xml:
class: Drupal\serialization\Encoder\XmlEncoder
tags:
- { name: encoder, format: xml }

View File

@ -1,26 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\serialization_test\SerializationTestBundle.
*/
namespace Drupal\serialization_test;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* SerializationTest dependency injection container.
*/
class SerializationTestBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('serializer.normalizer.serialization_test', 'Drupal\serialization_test\SerializationTestNormalizer')->addTag('normalizer');
$container->register('serializer.encoder.serialization_test', 'Drupal\serialization_test\SerializationTestEncoder')
->addTag('encoder', array('format' => array('serialization_test' => 'Serialization test')));
}
}

View File

@ -0,0 +1,9 @@
services:
serializer.normalizer.serialization_test:
class: Drupal\serialization_test\SerializationTestNormalizer
tags:
- { name: normalizer }
serializer.encoder.serialization_test:
class: Drupal\serialization_test\SerializationTestEncoder
tags:
- { name: encoder, format: serialization_test}

View File

@ -1,30 +0,0 @@
<?php
/**
* @file
* Contains Drupal\system\SystemBundle.
*/
namespace Drupal\system;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* System dependency injection container.
*/
class SystemBundle extends Bundle {
/**
* Overrides Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('access_check.cron', 'Drupal\system\Access\CronAccessCheck')
->addTag('access_check');
// Register the various system plugin manager classes with the dependency
// injection container.
$container->register('plugin.manager.system.plugin_ui', 'Drupal\system\Plugin\Type\PluginUIManager')
->addArgument('%container.namespaces%');
}
}

View File

@ -2017,7 +2017,7 @@ function system_update_8046() {
$module_list = drupal_container()->getParameter('container.modules');
drupal_load('module', 'views');
drupal_container()->get('kernel')->updateModules(array_keys($module_list), array('views' => 'core/modules/views/views.module'));
drupal_container()->get('kernel')->updateModules($module_list, array('views' => 'core/modules/views/views.module'));
// This does not fire a hook just calls views.
config_install_default_config('module', 'views');

View File

@ -0,0 +1,8 @@
services:
access_check.cron:
class: Drupal\system\Access\CronAccessCheck
tags:
- { name: access_check }
plugin.manager.system.plugin_ui:
class: Drupal\system\Plugin\Type\PluginUIManager
arguments: ['%container.namespaces%']

View File

@ -0,0 +1,9 @@
services:
bundle_test_class:
class: Drupal\bundle_test\TestClass
tags:
- { name: event_subscriber }
- { name: needs_destruction }
arguments: ['@state']
file.usage:
class: Drupal\bundle_test\TestFileUsage

View File

@ -1,29 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\bundle_test\BundleTestBundle.
*/
namespace Drupal\bundle_test;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Test bundle class.
*/
class BundleTestBundle extends Bundle
{
public function build(ContainerBuilder $container) {
$container->register('bundle_test_class', 'Drupal\bundle_test\TestClass')
->addArgument(new Reference('state'))
->addTag('event_subscriber')
->addTag('needs_destruction');
// Override a default bundle used by core to a dummy class.
$container->register('file.usage', 'Drupal\bundle_test\TestFileUsage');
}
}

View File

@ -0,0 +1,3 @@
services:
form_test.form.serviceform:
class: Drupal\form_test\FormTestServiceObject

View File

@ -1,26 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\form_test\FormTestndle.
*/
namespace Drupal\form_test;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Reference;
/**
* Form test dependency injection container.
*/
class FormTestBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('form_test.form.serviceForm', 'Drupal\form_test\FormTestServiceObject');
}
}

View File

@ -1,25 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\session_test\SessionTestBundle.
*/
namespace Drupal\session_test;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Defines the SessionTest bundle.
*/
class SessionTestBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('session_test.subscriber', 'Drupal\session_test\EventSubscriber\SessionTestSubscriber')
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,5 @@
services:
session_test.subscriber:
class: Drupal\session_test\EventSubscriber\SessionTestSubscriber
tags:
- { name: event_subscriber }

View File

@ -1,27 +0,0 @@
<?php
/**
* @file
* Contains Drupal\url_alter_test\UrlAlterTestBundle.
*/
namespace Drupal\url_alter_test;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Test bundle class for url_alter_test.
*
* Used to register an event subscriber that resolves a path alias to a system
* path based on an arbitrary set of rules.
*
* @see \Drupal\url_alter_test\PathSubscriber
*/
class UrlAlterTestBundle extends Bundle
{
public function build(ContainerBuilder $container) {
$container->register('url_alter_test.path_subscriber', 'Drupal\url_alter_test\PathSubscriber')
->addTag('event_subscriber');
}
}

View File

@ -0,0 +1,5 @@
services:
url_alter_test.path_subscriber:
class: Drupal\url_alter_test\PathSubscriber
tags:
- { name: event_subscriber }

View File

@ -1,26 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\toolbar\ToolbarBundle.
*/
namespace Drupal\toolbar;
use Drupal\Core\Cache\CacheFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Registers toolbar module's services to the container.
*/
class ToolbarBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
CacheFactory::registerBin($container, 'toolbar');
}
}

View File

@ -0,0 +1,8 @@
services:
cache.toolbar:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [toolbar]

View File

@ -1,28 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\tour\TourBundle.
*/
namespace Drupal\tour;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Tour dependency injection container.
*/
class TourBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
// Register the plugin manager for our plugin type with the dependency
// injection container.
$container->register('plugin.manager.tour.tip', 'Drupal\tour\TipPluginManager')
->addArgument('%container.namespaces%');
}
}

View File

@ -0,0 +1,4 @@
services:
plugin.manager.tour.tip:
class: Drupal\tour\TipPluginManager
arguments: ['%container.namespaces%']

View File

@ -1,27 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\translation_entity\TranslationEntityBundle.
*/
namespace Drupal\translation_entity;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Registers locale module's services to the container.
*/
class TranslationEntityBundle extends Bundle {
/**
* Implements \Symfony\Component\HttpKernel\Bundle\BundleInterface::build().
*/
public function build(ContainerBuilder $container) {
$container->register('translation_entity.synchronizer', 'Drupal\translation_entity\FieldTranslationSynchronizer')
->addArgument(new Reference('plugin.manager.entity'));
}
}

View File

@ -0,0 +1,4 @@
services:
translation_entity.synchronizer:
class: Drupal\translation_entity\FieldTranslationSynchronizer
arguments: ['@plugin.manager.entity']

View File

@ -1,34 +0,0 @@
<?php
/**
* @file
* Contains Drupal\user\UserBundle.
*/
namespace Drupal\user;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* User dependency injection container.
*/
class UserBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('access_check.permission', 'Drupal\user\Access\PermissionAccessCheck')
->addTag('access_check');
$container->register('access_check.user.register', 'Drupal\user\Access\RegisterAccessCheck')
->addTag('access_check');
$container
->register('user.data', 'Drupal\user\UserData')
->addArgument(new Reference('database'));
$container->register('user.autocomplete', 'Drupal\user\UserAutocomplete')
->addArgument(new Reference('database'))
->addArgument(new Reference('config.factory'));
}
}

View File

@ -1,20 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\user_custom_phpass_params_test\UserCustomPhpassParamsTestBundle
*/
namespace Drupal\user_custom_phpass_params_test;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class UserCustomPhpassParamsTestBundle extends Bundle
{
public function build(ContainerBuilder $container) {
// Override the default password hashing service parameters
$container->register('password', 'Drupal\Core\Password\PhpassHashedPassword')
->addArgument(19);
}
}

View File

@ -0,0 +1,4 @@
services:
password:
class: Drupal\Core\Password\PhpassHashedPassword
arguments: [19]

View File

@ -0,0 +1,15 @@
services:
access_check.permission:
class: Drupal\user\Access\PermissionAccessCheck
tags:
- { name: access_check }
access_check.user.register:
class: Drupal\user\Access\RegisterAccessCheck
tags:
- { name: access_check }
user.data:
class: Drupal\user\UserData
arguments: ['@database']
user.autocomplete:
class: Drupal\user\UserAutocomplete
arguments: ['@database', '@config.factory']

View File

@ -1,45 +0,0 @@
<?php
/**
* @file
* Definition of Drupal\views\ViewsBundle.
*/
namespace Drupal\views;
use Drupal\Core\Cache\CacheFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Reference;
use Drupal\views\ViewExecutable;
/**
* Views dependency injection container.
*/
class ViewsBundle extends Bundle {
/**
* Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
foreach (ViewExecutable::getPluginTypes() as $type) {
$container->register("plugin.manager.views.$type", 'Drupal\views\Plugin\ViewsPluginManager')
->addArgument($type)
->addArgument('%container.namespaces%');
}
$container->register('views.views_data', 'Drupal\views\ViewsDataCache')
->addArgument(new Reference('cache.views_info'))
->addArgument(new Reference('config.factory'))
->addArgument(new Reference('module_handler'))
->addTag('needs_destruction');
$container->register('views.executable', 'Drupal\views\ViewExecutableFactory');
$container->register('views.analyzer', 'Drupal\views\Analyzer')
->addArgument(new Reference('module_handler'));
CacheFactory::registerBin($container, 'views_info');
CacheFactory::registerBin($container, 'views_results');
}
}

View File

@ -0,0 +1,82 @@
services:
plugin.manager.views.access:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [access, '%container.namespaces%']
plugin.manager.views.area:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [area, '%container.namespaces%']
plugin.manager.views.argument:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [argument, '%container.namespaces%']
plugin.manager.views.argument_default:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [argument_default, '%container.namespaces%']
plugin.manager.views.argument_validator:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [argument_validator, '%container.namespaces%']
plugin.manager.views.cache:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [cache, '%container.namespaces%']
plugin.manager.views.display_extender:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [display_extender, '%container.namespaces%']
plugin.manager.views.display:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [display, '%container.namespaces%']
plugin.manager.views.exposed_form:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [exposed_form, '%container.namespaces%']
plugin.manager.views.field:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [field, '%container.namespaces%']
plugin.manager.views.filter:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [filter, '%container.namespaces%']
plugin.manager.views.join:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [join, '%container.namespaces%']
plugin.manager.views.pager:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [pager, '%container.namespaces%']
plugin.manager.views.query:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [query, '%container.namespaces%']
plugin.manager.views.relationship:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [relationship, '%container.namespaces%']
plugin.manager.views.row:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [row, '%container.namespaces%']
plugin.manager.views.sort:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [sort, '%container.namespaces%']
plugin.manager.views.style:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [style, '%container.namespaces%']
plugin.manager.views.wizard:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [wizard, '%container.namespaces%']
views.views_data:
class: Drupal\views\ViewsDataCache
tags:
- { name: needs_destruction }
arguments: ['@cache.views_info', '@config.factory', '@module_handler']
views.executable:
class: Drupal\views\ViewExecutableFactory
views.analyzer:
class: Drupal\views\Analyzer
arguments: ['@module_handler']
cache.views_info:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [views_info]
cache.views_results:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [views_results]

View File

@ -1,28 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\views_ui\ViewsBundle.
*/
namespace Drupal\views_ui;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Reference;
/**
* Views UI dependency injection container.
*/
class ViewsUiBundle extends Bundle {
/**
* Overrides \Symfony\Component\HttpKernel\Bundle\Bundle::build().
*/
public function build(ContainerBuilder $container) {
$container->register('paramconverter.views_ui', 'Drupal\views_ui\ParamConverter\ViewUIConverter')
->addArgument(new Reference('user.tempstore'))
->addTag('paramconverter');
}
}

View File

@ -0,0 +1,6 @@
services:
paramconverter.views_ui:
class: Drupal\views_ui\ParamConverter\ViewUIConverter
arguments: ['@user.tempstore']
tags:
- { name: paramconverter }