summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-04-09 04:32:49 (GMT)
committer Alex Pott2013-04-09 04:32:49 (GMT)
commit34e630950a5a8dbb63fddd7824783a029c927fa8 (patch)
tree941c2026bff88fba62c395c95608bb86b63aadd6
parent31256993e6a634f60749f4ff2349ddecaad0cea4 (diff)
Issue #1939660 by chx | catch: Use YAML as the primary means for service registration.
-rw-r--r--core/core.services.yml372
-rw-r--r--core/lib/Drupal/Core/Cache/CacheFactory.php16
-rw-r--r--core/lib/Drupal/Core/Config/FileStorageFactory.php32
-rw-r--r--core/lib/Drupal/Core/CoreBundle.php368
-rw-r--r--core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php255
-rw-r--r--core/lib/Drupal/Core/DrupalKernel.php26
-rw-r--r--core/modules/aggregator/aggregator.services.yml10
-rw-r--r--core/modules/aggregator/lib/Drupal/aggregator/AggregatorBundle.php29
-rw-r--r--core/modules/ban/ban.services.yml9
-rw-r--r--core/modules/ban/lib/Drupal/ban/BanBundle.php29
-rw-r--r--core/modules/block/block.services.yml11
-rw-r--r--core/modules/block/lib/Drupal/block/BlockBundle.php29
-rw-r--r--core/modules/ckeditor/ckeditor.services.yml4
-rw-r--r--core/modules/ckeditor/lib/Drupal/ckeditor/CkeditorBundle.php27
-rw-r--r--core/modules/edit/edit.services.yml14
-rw-r--r--core/modules/edit/lib/Drupal/edit/EditBundle.php38
-rw-r--r--core/modules/editor/editor.services.yml4
-rw-r--r--core/modules/editor/lib/Drupal/editor/EditorBundle.php28
-rw-r--r--core/modules/entity_reference/entity_reference.services.yml7
-rw-r--r--core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceBundle.php30
-rw-r--r--core/modules/field/field.services.yml14
-rw-r--r--core/modules/field/lib/Drupal/field/FieldBundle.php31
-rw-r--r--core/modules/field_sql_storage/field_sql_storage.services.yml4
-rw-r--r--core/modules/field_sql_storage/lib/Drupal/field_sql_storage/FieldSqlStorageBundle.php22
-rw-r--r--core/modules/file/file.services.yml4
-rw-r--r--core/modules/file/lib/Drupal/file/FileBundle.php19
-rw-r--r--core/modules/filter/filter.services.yml12
-rw-r--r--core/modules/filter/lib/Drupal/filter/FilterBundle.php29
-rw-r--r--core/modules/hal/hal.services.yml33
-rw-r--r--core/modules/hal/lib/Drupal/hal/HalBundle.php49
-rw-r--r--core/modules/jsonld/jsonld.services.yml39
-rw-r--r--core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php72
-rw-r--r--core/modules/language/language.services.yml6
-rw-r--r--core/modules/language/lib/Drupal/language/LanguageBundle.php29
-rw-r--r--core/modules/layout/layout.services.yml4
-rw-r--r--core/modules/layout/lib/Drupal/layout/LayoutBundle.php26
-rw-r--r--core/modules/locale/lib/Drupal/locale/LocaleBundle.php29
-rw-r--r--core/modules/locale/locale.services.yml6
-rw-r--r--core/modules/rdf/lib/Drupal/rdf/RdfBundle.php39
-rw-r--r--core/modules/rdf/rdf.services.yml16
-rw-r--r--core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/RdfTestMappingBundle.php27
-rw-r--r--core/modules/rdf/tests/rdf_test_mapping/rdf_test_mapping.services.yml5
-rw-r--r--core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php2
-rw-r--r--core/modules/rest/lib/Drupal/rest/RestBundle.php43
-rw-r--r--core/modules/rest/rest.services.yml21
-rw-r--r--core/modules/serialization/lib/Drupal/serialization/RegisterSerializationClassesCompilerPass.php4
-rw-r--r--core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php14
-rw-r--r--core/modules/serialization/serialization.services.yml24
-rw-r--r--core/modules/serialization/tests/serialization_test/lib/Drupal/serialization_test/SerializationTestBundle.php26
-rw-r--r--core/modules/serialization/tests/serialization_test/serialization_test.services.yml9
-rw-r--r--core/modules/system/lib/Drupal/system/SystemBundle.php30
-rw-r--r--core/modules/system/system.install2
-rw-r--r--core/modules/system/system.services.yml8
-rw-r--r--core/modules/system/tests/modules/bundle_test/bundle_test.services.yml9
-rw-r--r--core/modules/system/tests/modules/bundle_test/lib/Drupal/bundle_test/BundleTestBundle.php29
-rw-r--r--core/modules/system/tests/modules/form_test/form_test.services.yml3
-rw-r--r--core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php26
-rw-r--r--core/modules/system/tests/modules/session_test/lib/Drupal/session_test/SessionTestBundle.php25
-rw-r--r--core/modules/system/tests/modules/session_test/session_test.services.yml5
-rw-r--r--core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/UrlAlterTestBundle.php27
-rw-r--r--core/modules/system/tests/modules/url_alter_test/url_alter_test.services.yml5
-rw-r--r--core/modules/toolbar/lib/Drupal/toolbar/ToolbarBundle.php26
-rw-r--r--core/modules/toolbar/toolbar.services.yml8
-rw-r--r--core/modules/tour/lib/Drupal/tour/TourBundle.php28
-rw-r--r--core/modules/tour/tour.services.yml4
-rw-r--r--core/modules/translation_entity/lib/Drupal/translation_entity/TranslationEntityBundle.php27
-rw-r--r--core/modules/translation_entity/translation_entity.services.yml4
-rw-r--r--core/modules/user/lib/Drupal/user/UserBundle.php34
-rw-r--r--core/modules/user/tests/modules/user_custom_phpass_params_test/lib/Drupal/user_custom_phpass_params_test/UserCustomPhpassParamsTestBundle.php20
-rw-r--r--core/modules/user/tests/modules/user_custom_phpass_params_test/user_custom_phpass_params_test.services.yml4
-rw-r--r--core/modules/user/user.services.yml15
-rw-r--r--core/modules/views/lib/Drupal/views/ViewsBundle.php45
-rw-r--r--core/modules/views/views.services.yml82
-rw-r--r--core/modules/views/views_ui/lib/Drupal/views_ui/ViewsUiBundle.php28
-rw-r--r--core/modules/views/views_ui/views_ui.services.yml6
75 files changed, 1110 insertions, 1386 deletions
diff --git a/core/core.services.yml b/core/core.services.yml
new file mode 100644
index 0000000..c73db7f
--- /dev/null
+++ b/core/core.services.yml
@@ -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
diff --git a/core/lib/Drupal/Core/Cache/CacheFactory.php b/core/lib/Drupal/Core/Cache/CacheFactory.php
index aba2176..2697964 100644
--- a/core/lib/Drupal/Core/Cache/CacheFactory.php
+++ b/core/lib/Drupal/Core/Cache/CacheFactory.php
@@ -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');
- }
}
diff --git a/core/lib/Drupal/Core/Config/FileStorageFactory.php b/core/lib/Drupal/Core/Config/FileStorageFactory.php
new file mode 100644
index 0000000..1768df4
--- /dev/null
+++ b/core/lib/Drupal/Core/Config/FileStorageFactory.php
@@ -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));
+ }
+
+}
diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index ee63bfa..8734772 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -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
@@ -347,43 +86,9 @@ 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());
- }
-
}
diff --git a/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php
new file mode 100644
index 0000000..bd69f0f
--- /dev/null
+++ b/core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php
@@ -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;
+ }
+
+}
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 6a26314..884c99f 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -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;
@@ -100,6 +101,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.
*
* @param string $environment
@@ -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);
}
diff --git a/core/modules/aggregator/aggregator.services.yml b/core/modules/aggregator/aggregator.services.yml
new file mode 100644
index 0000000..1cedc0f
--- /dev/null
+++ b/core/modules/aggregator/aggregator.services.yml
@@ -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%']
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/AggregatorBundle.php b/core/modules/aggregator/lib/Drupal/aggregator/AggregatorBundle.php
deleted file mode 100644
index 2782029..0000000
--- a/core/modules/aggregator/lib/Drupal/aggregator/AggregatorBundle.php
+++ /dev/null
@@ -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%');
- }
- }
-
-}
diff --git a/core/modules/ban/ban.services.yml b/core/modules/ban/ban.services.yml
new file mode 100644
index 0000000..7f55ae6
--- /dev/null
+++ b/core/modules/ban/ban.services.yml
@@ -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']
diff --git a/core/modules/ban/lib/Drupal/ban/BanBundle.php b/core/modules/ban/lib/Drupal/ban/BanBundle.php
deleted file mode 100644
index e9a92bb..0000000
--- a/core/modules/ban/lib/Drupal/ban/BanBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/block/block.services.yml b/core/modules/block/block.services.yml
new file mode 100644
index 0000000..ddc3556
--- /dev/null
+++ b/core/modules/block/block.services.yml
@@ -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]
diff --git a/core/modules/block/lib/Drupal/block/BlockBundle.php b/core/modules/block/lib/Drupal/block/BlockBundle.php
deleted file mode 100644
index 1dd86e1..0000000
--- a/core/modules/block/lib/Drupal/block/BlockBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/ckeditor/ckeditor.services.yml b/core/modules/ckeditor/ckeditor.services.yml
new file mode 100644
index 0000000..143aaa6
--- /dev/null
+++ b/core/modules/ckeditor/ckeditor.services.yml
@@ -0,0 +1,4 @@
+services:
+ plugin.manager.ckeditor.plugin:
+ class: Drupal\ckeditor\CKEditorPluginManager
+ arguments: ['%container.namespaces%']
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/CkeditorBundle.php b/core/modules/ckeditor/lib/Drupal/ckeditor/CkeditorBundle.php
deleted file mode 100644
index 151c23a..0000000
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/CkeditorBundle.php
+++ /dev/null
@@ -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%');
- }
-
-}
diff --git a/core/modules/edit/edit.services.yml b/core/modules/edit/edit.services.yml
new file mode 100644
index 0000000..8f72c77
--- /dev/null
+++ b/core/modules/edit/edit.services.yml
@@ -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']
diff --git a/core/modules/edit/lib/Drupal/edit/EditBundle.php b/core/modules/edit/lib/Drupal/edit/EditBundle.php
deleted file mode 100644
index fe52594..0000000
--- a/core/modules/edit/lib/Drupal/edit/EditBundle.php
+++ /dev/null
@@ -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'));
- }
-
-}
diff --git a/core/modules/editor/editor.services.yml b/core/modules/editor/editor.services.yml
new file mode 100644
index 0000000..60f1609
--- /dev/null
+++ b/core/modules/editor/editor.services.yml
@@ -0,0 +1,4 @@
+services:
+ plugin.manager.editor:
+ class: Drupal\editor\Plugin\EditorManager
+ arguments: ['%container.namespaces%']
diff --git a/core/modules/editor/lib/Drupal/editor/EditorBundle.php b/core/modules/editor/lib/Drupal/editor/EditorBundle.php
deleted file mode 100644
index 0338998..0000000
--- a/core/modules/editor/lib/Drupal/editor/EditorBundle.php
+++ /dev/null
@@ -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%');
- }
-
-}
diff --git a/core/modules/entity_reference/entity_reference.services.yml b/core/modules/entity_reference/entity_reference.services.yml
new file mode 100644
index 0000000..6198f73
--- /dev/null
+++ b/core/modules/entity_reference/entity_reference.services.yml
@@ -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']
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceBundle.php b/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceBundle.php
deleted file mode 100644
index f9762b6..0000000
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/EntityReferenceBundle.php
+++ /dev/null
@@ -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'));
- }
-}
diff --git a/core/modules/field/field.services.yml b/core/modules/field/field.services.yml
new file mode 100644
index 0000000..8e79c7f
--- /dev/null
+++ b/core/modules/field/field.services.yml
@@ -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]
diff --git a/core/modules/field/lib/Drupal/field/FieldBundle.php b/core/modules/field/lib/Drupal/field/FieldBundle.php
deleted file mode 100644
index 9ca3ff9..0000000
--- a/core/modules/field/lib/Drupal/field/FieldBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/field_sql_storage/field_sql_storage.services.yml b/core/modules/field_sql_storage/field_sql_storage.services.yml
new file mode 100644
index 0000000..42126e4
--- /dev/null
+++ b/core/modules/field_sql_storage/field_sql_storage.services.yml
@@ -0,0 +1,4 @@
+services:
+ entity.query.field_sql_storage:
+ class: Drupal\field_sql_storage\Entity\QueryFactory
+ arguments: ['@database']
diff --git a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/FieldSqlStorageBundle.php b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/FieldSqlStorageBundle.php
deleted file mode 100644
index 2d5f996..0000000
--- a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/FieldSqlStorageBundle.php
+++ /dev/null
@@ -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'));
- }
-
-}
diff --git a/core/modules/file/file.services.yml b/core/modules/file/file.services.yml
new file mode 100644
index 0000000..2ded051
--- /dev/null
+++ b/core/modules/file/file.services.yml
@@ -0,0 +1,4 @@
+services:
+ file.usage:
+ class: Drupal\file\FileUsage\DatabaseFileUsageBackend
+ arguments: ['@database']
diff --git a/core/modules/file/lib/Drupal/file/FileBundle.php b/core/modules/file/lib/Drupal/file/FileBundle.php
deleted file mode 100644
index 79618ad..0000000
--- a/core/modules/file/lib/Drupal/file/FileBundle.php
+++ /dev/null
@@ -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'));
- }
-}
diff --git a/core/modules/filter/filter.services.yml b/core/modules/filter/filter.services.yml
new file mode 100644
index 0000000..af11a10
--- /dev/null
+++ b/core/modules/filter/filter.services.yml
@@ -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 }
diff --git a/core/modules/filter/lib/Drupal/filter/FilterBundle.php b/core/modules/filter/lib/Drupal/filter/FilterBundle.php
deleted file mode 100644
index b531e6a..0000000
--- a/core/modules/filter/lib/Drupal/filter/FilterBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/hal/hal.services.yml b/core/modules/hal/hal.services.yml
new file mode 100644
index 0000000..3dca437
--- /dev/null
+++ b/core/modules/hal/hal.services.yml
@@ -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 }
diff --git a/core/modules/hal/lib/Drupal/hal/HalBundle.php b/core/modules/hal/lib/Drupal/hal/HalBundle.php
deleted file mode 100644
index bb1e2dc..0000000
--- a/core/modules/hal/lib/Drupal/hal/HalBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/jsonld/jsonld.services.yml b/core/modules/jsonld/jsonld.services.yml
new file mode 100644
index 0000000..0359859
--- /dev/null
+++ b/core/modules/jsonld/jsonld.services.yml
@@ -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 }
diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php
deleted file mode 100644
index 3024883..0000000
--- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/language/language.services.yml b/core/modules/language/language.services.yml
new file mode 100644
index 0000000..052fdc0
--- /dev/null
+++ b/core/modules/language/language.services.yml
@@ -0,0 +1,6 @@
+services:
+ path_processor_language:
+ class: Drupal\language\HttpKernel\PathProcessorLanguage
+ tags:
+ - { name: path_processor_inbound, priority: 300 }
+ arguments: ['@module_handler']
diff --git a/core/modules/language/lib/Drupal/language/LanguageBundle.php b/core/modules/language/lib/Drupal/language/LanguageBundle.php
deleted file mode 100644
index 1e788aa..0000000
--- a/core/modules/language/lib/Drupal/language/LanguageBundle.php
+++ /dev/null
@@ -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));
- }
-
-}
diff --git a/core/modules/layout/layout.services.yml b/core/modules/layout/layout.services.yml
new file mode 100644
index 0000000..68d989c
--- /dev/null
+++ b/core/modules/layout/layout.services.yml
@@ -0,0 +1,4 @@
+services:
+ plugin.manager.layout:
+ class: Drupal\layout\Plugin\Type\LayoutManager
+ arguments: ['%container.namespaces%']
diff --git a/core/modules/layout/lib/Drupal/layout/LayoutBundle.php b/core/modules/layout/lib/Drupal/layout/LayoutBundle.php
deleted file mode 100644
index c639da9..0000000
--- a/core/modules/layout/lib/Drupal/layout/LayoutBundle.php
+++ /dev/null
@@ -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%');
- }
-}
diff --git a/core/modules/locale/lib/Drupal/locale/LocaleBundle.php b/core/modules/locale/lib/Drupal/locale/LocaleBundle.php
deleted file mode 100644
index 7c2ca6e..0000000
--- a/core/modules/locale/lib/Drupal/locale/LocaleBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml
new file mode 100644
index 0000000..012a7d9
--- /dev/null
+++ b/core/modules/locale/locale.services.yml
@@ -0,0 +1,6 @@
+services:
+ locale_config_subscriber:
+ class: Drupal\locale\LocaleConfigSubscriber
+ tags:
+ - { name: event_subscriber }
+ arguments: ['@language_manager', '@config.context']
diff --git a/core/modules/rdf/lib/Drupal/rdf/RdfBundle.php b/core/modules/rdf/lib/Drupal/rdf/RdfBundle.php
deleted file mode 100644
index 2d3aa76..0000000
--- a/core/modules/rdf/lib/Drupal/rdf/RdfBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/rdf/rdf.services.yml b/core/modules/rdf/rdf.services.yml
new file mode 100644
index 0000000..7b3a515
--- /dev/null
+++ b/core/modules/rdf/rdf.services.yml
@@ -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']
diff --git a/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/RdfTestMappingBundle.php b/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/RdfTestMappingBundle.php
deleted file mode 100644
index 3de3980..0000000
--- a/core/modules/rdf/tests/rdf_test_mapping/lib/Drupal/rdf_test_mapping/RdfTestMappingBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/rdf/tests/rdf_test_mapping/rdf_test_mapping.services.yml b/core/modules/rdf/tests/rdf_test_mapping/rdf_test_mapping.services.yml
new file mode 100644
index 0000000..0cb945e
--- /dev/null
+++ b/core/modules/rdf/tests/rdf_test_mapping/rdf_test_mapping.services.yml
@@ -0,0 +1,5 @@
+services:
+ rdf_test_mapping.mapping:
+ class: Drupal\rdf_test_mapping\EventSubscriber\TestMappingSubscriber
+ tags:
+ - { name: event_subscriber }
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php b/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php
index 347bfd0..94abc31 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/ResourceBase.php
@@ -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;
diff --git a/core/modules/rest/lib/Drupal/rest/RestBundle.php b/core/modules/rest/lib/Drupal/rest/RestBundle.php
deleted file mode 100644
index 1c98b79..0000000
--- a/core/modules/rest/lib/Drupal/rest/RestBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/rest/rest.services.yml b/core/modules/rest/rest.services.yml
new file mode 100644
index 0000000..30b0640
--- /dev/null
+++ b/core/modules/rest/rest.services.yml
@@ -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
diff --git a/core/modules/serialization/lib/Drupal/serialization/RegisterSerializationClassesCompilerPass.php b/core/modules/serialization/lib/Drupal/serialization/RegisterSerializationClassesCompilerPass.php
index e48af2e..60c2424 100644
--- a/core/modules/serialization/lib/Drupal/serialization/RegisterSerializationClassesCompilerPass.php
+++ b/core/modules/serialization/lib/Drupal/serialization/RegisterSerializationClassesCompilerPass.php
@@ -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);
}
diff --git a/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php b/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php
index a2744b5..bb0d386 100644
--- a/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php
+++ b/core/modules/serialization/lib/Drupal/serialization/SerializationBundle.php
@@ -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());
}
diff --git a/core/modules/serialization/serialization.services.yml b/core/modules/serialization/serialization.services.yml
new file mode 100644
index 0000000..8c80efa
--- /dev/null
+++ b/core/modules/serialization/serialization.services.yml
@@ -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 }
diff --git a/core/modules/serialization/tests/serialization_test/lib/Drupal/serialization_test/SerializationTestBundle.php b/core/modules/serialization/tests/serialization_test/lib/Drupal/serialization_test/SerializationTestBundle.php
deleted file mode 100644
index ab9f0f1..0000000
--- a/core/modules/serialization/tests/serialization_test/lib/Drupal/serialization_test/SerializationTestBundle.php
+++ /dev/null
@@ -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')));
- }
-}
diff --git a/core/modules/serialization/tests/serialization_test/serialization_test.services.yml b/core/modules/serialization/tests/serialization_test/serialization_test.services.yml
new file mode 100644
index 0000000..89c7c7b
--- /dev/null
+++ b/core/modules/serialization/tests/serialization_test/serialization_test.services.yml
@@ -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}
diff --git a/core/modules/system/lib/Drupal/system/SystemBundle.php b/core/modules/system/lib/Drupal/system/SystemBundle.php
deleted file mode 100644
index 2b937c0..0000000
--- a/core/modules/system/lib/Drupal/system/SystemBundle.php
+++ /dev/null
@@ -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%');
- }
-}
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 445b27c..493db9b 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -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');
diff --git a/core/modules/system/system.services.yml b/core/modules/system/system.services.yml
new file mode 100644
index 0000000..bf43cd4
--- /dev/null
+++ b/core/modules/system/system.services.yml
@@ -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%']
diff --git a/core/modules/system/tests/modules/bundle_test/bundle_test.services.yml b/core/modules/system/tests/modules/bundle_test/bundle_test.services.yml
new file mode 100644
index 0000000..88b3caf
--- /dev/null
+++ b/core/modules/system/tests/modules/bundle_test/bundle_test.services.yml
@@ -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
diff --git a/core/modules/system/tests/modules/bundle_test/lib/Drupal/bundle_test/BundleTestBundle.php b/core/modules/system/tests/modules/bundle_test/lib/Drupal/bundle_test/BundleTestBundle.php
deleted file mode 100644
index 19b50e1..0000000
--- a/core/modules/system/tests/modules/bundle_test/lib/Drupal/bundle_test/BundleTestBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/system/tests/modules/form_test/form_test.services.yml b/core/modules/system/tests/modules/form_test/form_test.services.yml
new file mode 100644
index 0000000..42ae7a6
--- /dev/null
+++ b/core/modules/system/tests/modules/form_test/form_test.services.yml
@@ -0,0 +1,3 @@
+services:
+ form_test.form.serviceform:
+ class: Drupal\form_test\FormTestServiceObject
diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php
deleted file mode 100644
index 0ccf9d8..0000000
--- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/SessionTestBundle.php b/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/SessionTestBundle.php
deleted file mode 100644
index b2a601e..0000000
--- a/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/SessionTestBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/system/tests/modules/session_test/session_test.services.yml b/core/modules/system/tests/modules/session_test/session_test.services.yml
new file mode 100644
index 0000000..8ef2e20
--- /dev/null
+++ b/core/modules/system/tests/modules/session_test/session_test.services.yml
@@ -0,0 +1,5 @@
+services:
+ session_test.subscriber:
+ class: Drupal\session_test\EventSubscriber\SessionTestSubscriber
+ tags:
+ - { name: event_subscriber }
diff --git a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/UrlAlterTestBundle.php b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/UrlAlterTestBundle.php
deleted file mode 100644
index cd028e8..0000000
--- a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/UrlAlterTestBundle.php
+++ /dev/null
@@ -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');
- }
-}
diff --git a/core/modules/system/tests/modules/url_alter_test/url_alter_test.services.yml b/core/modules/system/tests/modules/url_alter_test/url_alter_test.services.yml
new file mode 100644
index 0000000..e657682
--- /dev/null
+++ b/core/modules/system/tests/modules/url_alter_test/url_alter_test.services.yml
@@ -0,0 +1,5 @@
+services:
+ url_alter_test.path_subscriber:
+ class: Drupal\url_alter_test\PathSubscriber
+ tags:
+ - { name: event_subscriber }
diff --git a/core/modules/toolbar/lib/Drupal/toolbar/ToolbarBundle.php b/core/modules/toolbar/lib/Drupal/toolbar/ToolbarBundle.php
deleted file mode 100644
index 30321ed..0000000
--- a/core/modules/toolbar/lib/Drupal/toolbar/ToolbarBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/toolbar/toolbar.services.yml b/core/modules/toolbar/toolbar.services.yml
new file mode 100644
index 0000000..7f26968
--- /dev/null
+++ b/core/modules/toolbar/toolbar.services.yml
@@ -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]
diff --git a/core/modules/tour/lib/Drupal/tour/TourBundle.php b/core/modules/tour/lib/Drupal/tour/TourBundle.php
deleted file mode 100644
index bb50299..0000000
--- a/core/modules/tour/lib/Drupal/tour/TourBundle.php
+++ /dev/null
@@ -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%');
- }
-
-}
diff --git a/core/modules/tour/tour.services.yml b/core/modules/tour/tour.services.yml
new file mode 100644
index 0000000..36a5df2
--- /dev/null
+++ b/core/modules/tour/tour.services.yml
@@ -0,0 +1,4 @@
+services:
+ plugin.manager.tour.tip:
+ class: Drupal\tour\TipPluginManager
+ arguments: ['%container.namespaces%']
diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/TranslationEntityBundle.php b/core/modules/translation_entity/lib/Drupal/translation_entity/TranslationEntityBundle.php
deleted file mode 100644
index f36e702..0000000
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/TranslationEntityBundle.php
+++ /dev/null
@@ -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'));
- }
-
-}
diff --git a/core/modules/translation_entity/translation_entity.services.yml b/core/modules/translation_entity/translation_entity.services.yml
new file mode 100644
index 0000000..541bd3d
--- /dev/null
+++ b/core/modules/translation_entity/translation_entity.services.yml
@@ -0,0 +1,4 @@
+services:
+ translation_entity.synchronizer:
+ class: Drupal\translation_entity\FieldTranslationSynchronizer
+ arguments: ['@plugin.manager.entity']
diff --git a/core/modules/user/lib/Drupal/user/UserBundle.php b/core/modules/user/lib/Drupal/user/UserBundle.php
deleted file mode 100644
index f7c4a88..0000000
--- a/core/modules/user/lib/Drupal/user/UserBundle.php
+++ /dev/null
@@ -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'));
- }
-}
diff --git a/core/modules/user/tests/modules/user_custom_phpass_params_test/lib/Drupal/user_custom_phpass_params_test/UserCustomPhpassParamsTestBundle.php b/core/modules/user/tests/modules/user_custom_phpass_params_test/lib/Drupal/user_custom_phpass_params_test/UserCustomPhpassParamsTestBundle.php
deleted file mode 100644
index ab68d2e..0000000
--- a/core/modules/user/tests/modules/user_custom_phpass_params_test/lib/Drupal/user_custom_phpass_params_test/UserCustomPhpassParamsTestBundle.php
+++ /dev/null
@@ -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);
- }
-}
diff --git a/core/modules/user/tests/modules/user_custom_phpass_params_test/user_custom_phpass_params_test.services.yml b/core/modules/user/tests/modules/user_custom_phpass_params_test/user_custom_phpass_params_test.services.yml
new file mode 100644
index 0000000..8950bfe
--- /dev/null
+++ b/core/modules/user/tests/modules/user_custom_phpass_params_test/user_custom_phpass_params_test.services.yml
@@ -0,0 +1,4 @@
+services:
+ password:
+ class: Drupal\Core\Password\PhpassHashedPassword
+ arguments: [19]
diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml
new file mode 100644
index 0000000..e8c5e52
--- /dev/null
+++ b/core/modules/user/user.services.yml
@@ -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']
diff --git a/core/modules/views/lib/Drupal/views/ViewsBundle.php b/core/modules/views/lib/Drupal/views/ViewsBundle.php
deleted file mode 100644
index c33e4b0..0000000
--- a/core/modules/views/lib/Drupal/views/ViewsBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml
new file mode 100644
index 0000000..633db50
--- /dev/null
+++ b/core/modules/views/views.services.yml
@@ -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]
diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewsUiBundle.php b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewsUiBundle.php
deleted file mode 100644
index 3d001a6..0000000
--- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewsUiBundle.php
+++ /dev/null
@@ -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');
- }
-
-}
diff --git a/core/modules/views/views_ui/views_ui.services.yml b/core/modules/views/views_ui/views_ui.services.yml
new file mode 100644
index 0000000..34b2740
--- /dev/null
+++ b/core/modules/views/views_ui/views_ui.services.yml
@@ -0,0 +1,6 @@
+services:
+ paramconverter.views_ui:
+ class: Drupal\views_ui\ParamConverter\ViewUIConverter
+ arguments: ['@user.tempstore']
+ tags:
+ - { name: paramconverter }