diff --git a/core/core.services.yml b/core/core.services.yml index 9466f9521864e9468c0b95a940c92e70586c21bd..12498b7a9623504bd1297325beb29f342629a4b1 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -225,7 +225,7 @@ services: - [setContainer, ['@service_container']] default_plugin_manager: abstract: true - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler'] module_handler: class: Drupal\Core\Extension\ModuleHandler arguments: ['%container.modules%', '@cache.bootstrap'] @@ -243,19 +243,19 @@ services: arguments: ['@entity.manager', '@form_builder'] plugin.manager.field.field_type: class: Drupal\Core\Field\FieldTypePluginManager - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.field.widget: class: Drupal\Core\Field\WidgetPluginManager - arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@language_manager', '@plugin.manager.field.field_type'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@plugin.manager.field.field_type'] plugin.manager.field.formatter: class: Drupal\Core\Field\FormatterPluginManager - arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@language_manager', '@plugin.manager.field.field_type'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@plugin.manager.field.field_type'] plugin.manager.archiver: class: Drupal\Core\Archiver\ArchiverManager parent: default_plugin_manager plugin.manager.action: class: Drupal\Core\Action\ActionManager - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.menu.local_action: class: Drupal\Core\Menu\LocalActionManager arguments: ['@controller_resolver', '@request_stack', '@router.route_provider', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user'] @@ -678,7 +678,7 @@ services: arguments: ['@database', '@request_stack'] plugin.manager.mail: class: Drupal\Core\Mail\MailManager - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', '@config.factory'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@config.factory'] plugin.manager.condition: class: Drupal\Core\Condition\ConditionManager parent: default_plugin_manager @@ -694,7 +694,7 @@ services: - { name: event_subscriber } image.toolkit.manager: class: Drupal\Core\ImageToolkit\ImageToolkitManager - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@config.factory', '@module_handler'] + arguments: ['@container.namespaces', '@cache.discovery', '@config.factory', '@module_handler'] image.factory: class: Drupal\Core\Image\ImageFactory arguments: ['@image.toolkit.manager'] diff --git a/core/lib/Drupal/Core/Action/ActionManager.php b/core/lib/Drupal/Core/Action/ActionManager.php index fbd824e399b9645b5c50454cdfb30b6032e1f3e0..b77e0f8a6b8ddc3db68dd9911dfda0b39f8517cb 100644 --- a/core/lib/Drupal/Core/Action/ActionManager.php +++ b/core/lib/Drupal/Core/Action/ActionManager.php @@ -9,10 +9,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; -use Drupal\Core\Plugin\Discovery\AlterDecorator; -use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; /** * Provides an Action plugin manager. @@ -30,15 +27,13 @@ class ActionManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Action', $namespaces, $module_handler, 'Drupal\Core\Annotation\Action'); $this->alterInfo('action_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'action_info'); + $this->setCacheBackend($cache_backend, 'action_info'); } /** diff --git a/core/lib/Drupal/Core/Archiver/ArchiverManager.php b/core/lib/Drupal/Core/Archiver/ArchiverManager.php index e45fc875aaedd1f9843c99ac14e75509050e6d80..e3dd4ab89f75b15e85178cc3cb982b046cb875c3 100644 --- a/core/lib/Drupal/Core/Archiver/ArchiverManager.php +++ b/core/lib/Drupal/Core/Archiver/ArchiverManager.php @@ -9,7 +9,6 @@ use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -25,15 +24,13 @@ class ArchiverManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Archiver', $namespaces, $module_handler, 'Drupal\Core\Archiver\Annotation\Archiver'); $this->alterInfo('archiver_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'archiver_info_plugins'); + $this->setCacheBackend($cache_backend, 'archiver_info_plugins'); } /** diff --git a/core/lib/Drupal/Core/Condition/ConditionManager.php b/core/lib/Drupal/Core/Condition/ConditionManager.php index ca24adddbbb7b0afe05b97d14264ec6feadafd6a..f6f7641e9c1c046604182065f5914639c2c1b997 100644 --- a/core/lib/Drupal/Core/Condition/ConditionManager.php +++ b/core/lib/Drupal/Core/Condition/ConditionManager.php @@ -11,7 +11,6 @@ use Drupal\Core\Executable\ExecutableManagerInterface; use Drupal\Core\Executable\ExecutableInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait; use Drupal\Core\Plugin\DefaultPluginManager; @@ -30,14 +29,12 @@ class ConditionManager extends DefaultPluginManager implements ExecutableManager * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { $this->alterInfo('condition_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'condition_plugins'); + $this->setCacheBackend($cache_backend, 'condition_plugins'); parent::__construct('Plugin/Condition', $namespaces, $module_handler, 'Drupal\Core\Condition\Annotation\Condition'); } diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index c82a55824dfa00194884bc2fa9235a3902633ef2..5e2ad0353a4e67079d4e7071d04e283de116f52d 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -103,6 +103,13 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa */ protected $typedDataManager; + /** + * The language manager. + * + * @var \Drupal\Core\Language\LanguageManagerInterface + */ + protected $languageManager; + /** * Static cache of bundle information. * @@ -147,9 +154,10 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa public function __construct(\Traversable $namespaces, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, TranslationInterface $translation_manager, ClassResolverInterface $class_resolver, TypedDataManager $typed_data_manager) { parent::__construct('Entity', $namespaces, $module_handler, 'Drupal\Core\Entity\Annotation\EntityType'); - $this->setCacheBackend($cache, $language_manager, 'entity_type:', array('entity_types' => TRUE)); + $this->setCacheBackend($cache, 'entity_type', array('entity_types' => TRUE)); $this->alterInfo('entity_type'); + $this->languageManager = $language_manager; $this->translationManager = $translation_manager; $this->classResolver = $class_resolver; $this->typedDataManager = $typed_data_manager; diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index 31d07c49014c2c183c87b49154efe14e6cfa358a..9f64aaf0845e1282f01c374ca8e6ee17658e6f89 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -10,7 +10,6 @@ use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -26,15 +25,13 @@ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePl * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface * The module handler. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Field/FieldType', $namespaces, $module_handler, 'Drupal\Core\Field\Annotation\FieldType'); $this->alterInfo('field_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'field_types_plugins'); + $this->setCacheBackend($cache_backend, 'field_types_plugins'); } /** diff --git a/core/lib/Drupal/Core/Field/FormatterPluginManager.php b/core/lib/Drupal/Core/Field/FormatterPluginManager.php index 586fcb1089bf8734219eec5937f9e7e092cd43ff..0d9e516f66fd37f3689aee57b37835f2cc4c6c26 100644 --- a/core/lib/Drupal/Core/Field/FormatterPluginManager.php +++ b/core/lib/Drupal/Core/Field/FormatterPluginManager.php @@ -10,7 +10,6 @@ use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -42,16 +41,14 @@ class FormatterPluginManager extends DefaultPluginManager { * Cache backend instance to use. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The 'field type' plugin manager. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LanguageManager $language_manager, FieldTypePluginManagerInterface $field_type_manager) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager) { parent::__construct('Plugin/Field/FieldFormatter', $namespaces, $module_handler, 'Drupal\Core\Field\Annotation\FieldFormatter'); - $this->setCacheBackend($cache_backend, $language_manager, 'field_formatter_types_plugins'); + $this->setCacheBackend($cache_backend, 'field_formatter_types_plugins'); $this->alterInfo('field_formatter_info'); $this->fieldTypeManager = $field_type_manager; } diff --git a/core/lib/Drupal/Core/Field/WidgetPluginManager.php b/core/lib/Drupal/Core/Field/WidgetPluginManager.php index ce784410bf3e774c6fa046067e458c43313d4d45..55c1fc5eee9d099fd303c32fdc70074ce03e18cd 100644 --- a/core/lib/Drupal/Core/Field/WidgetPluginManager.php +++ b/core/lib/Drupal/Core/Field/WidgetPluginManager.php @@ -10,7 +10,6 @@ use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -42,15 +41,13 @@ class WidgetPluginManager extends DefaultPluginManager { * Cache backend instance to use. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The 'field type' plugin manager. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LanguageManager $language_manager, FieldTypePluginManagerInterface $field_type_manager) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager) { parent::__construct('Plugin/Field/FieldWidget', $namespaces, $module_handler, 'Drupal\Core\Field\Annotation\FieldWidget'); - $this->setCacheBackend($cache_backend, $language_manager, 'field_widget_types_plugins'); + $this->setCacheBackend($cache_backend, 'field_widget_types_plugins'); $this->alterInfo('field_widget_info'); $this->factory = new WidgetFactory($this); diff --git a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php index e5035588f279b94ccef53f593f78281342f5677c..a7806306e244c86ad2d48d983896e79453a17d24 100644 --- a/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php +++ b/core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php @@ -10,7 +10,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -33,17 +32,15 @@ class ImageToolkitManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/ImageToolkit', $namespaces, $module_handler, 'Drupal\Core\ImageToolkit\Annotation\ImageToolkit'); - $this->setCacheBackend($cache_backend, $language_manager, 'image_toolkit_plugins'); + $this->setCacheBackend($cache_backend, 'image_toolkit_plugins'); $this->configFactory = $config_factory; } diff --git a/core/lib/Drupal/Core/Mail/MailManager.php b/core/lib/Drupal/Core/Mail/MailManager.php index 3fe58f1c5382df83f259393356282ff7df5d4475..8fafc0c03782aa9cd2f37cccf17b7c3e86e43068 100644 --- a/core/lib/Drupal/Core/Mail/MailManager.php +++ b/core/lib/Drupal/Core/Mail/MailManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Component\Utility\String; @@ -42,17 +41,15 @@ class MailManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The configuration factory. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) { parent::__construct('Plugin/Mail', $namespaces, $module_handler, 'Drupal\Core\Annotation\Mail'); $this->alterInfo('mail_backend_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'mail_backend_plugins'); + $this->setCacheBackend($cache_backend, 'mail_backend_plugins'); $this->mailConfig = $config_factory->get('system.mail'); } diff --git a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php index 418770fc2f2fb9e107ad5d5655bfe19b8ec18a33..0efe4ba74e4088e93f5617e00cd5f40297f2371e 100644 --- a/core/lib/Drupal/Core/Menu/ContextualLinkManager.php +++ b/core/lib/Drupal/Core/Menu/ContextualLinkManager.php @@ -113,7 +113,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Mo $this->moduleHandler = $module_handler; $this->requestStack = $request_stack; $this->alterInfo('contextual_links_plugins'); - $this->setCacheBackend($cache_backend, $language_manager, 'contextual_links_plugins'); + $this->setCacheBackend($cache_backend, 'contextual_links_plugins:' . $language_manager->getCurrentLanguage()->getId(), array('contextual_links_plugins' => TRUE)); } /** diff --git a/core/lib/Drupal/Core/Menu/LocalActionManager.php b/core/lib/Drupal/Core/Menu/LocalActionManager.php index 980968080c85e86962ff39dac381892a2ca8b263..75e499fb0dce067ad5fd90ca75419f941741f11f 100644 --- a/core/lib/Drupal/Core/Menu/LocalActionManager.php +++ b/core/lib/Drupal/Core/Menu/LocalActionManager.php @@ -132,7 +132,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re $this->moduleHandler = $module_handler; $this->account = $account; $this->alterInfo('menu_local_actions'); - $this->setCacheBackend($cache_backend, $language_manager, 'local_action_plugins', array('local_action' => TRUE)); + $this->setCacheBackend($cache_backend, 'local_action_plugins:' . $language_manager->getCurrentLanguage()->getId(), array('local_action' => TRUE)); } /** diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php index 1436370d927107ee81079b8e152e103d2f69ad5f..b9465bf3648ec43d9a2b68a611e6ecf8bdba9bf1 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php @@ -139,7 +139,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re $this->account = $account; $this->moduleHandler = $module_handler; $this->alterInfo('local_tasks'); - $this->setCacheBackend($cache, $language_manager, 'local_task_plugins', array('local_task' => TRUE)); + $this->setCacheBackend($cache, 'local_task_plugins:' . $language_manager->getCurrentLanguage()->getId(), array('local_task' => TRUE)); } /** diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 6ee638931208f12dca92c4bca540a0cac4674cb3..4f426cc776d7e1e6f3ed486a40f319c1be5ad7e5 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -36,14 +36,7 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt protected $cacheBackend; /** - * Provided cache key prefix. - * - * @var string - */ - protected $cacheKeyPrefix; - - /** - * Actually used cache key with the language code appended. + * The cache key. * * @var string */ @@ -78,13 +71,6 @@ class DefaultPluginManager extends PluginManagerBase implements PluginManagerInt */ protected $moduleHandler; - /** - * The language manager. - * - * @var \Drupal\Core\Language\LanguageManagerInterface - */ - protected $languageManager; - /** * A set of defaults to be referenced by $this->processDefinition() if * additional processing of plugins is necessary or helpful for development @@ -124,9 +110,7 @@ public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInte * * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManagerInterface - * The language manager. - * @param string $cache_key_prefix + * @param string $cache_key * Cache key prefix to use, the language code will be appended * automatically. * @param array $cache_tags @@ -138,11 +122,9 @@ public function __construct($subdir, \Traversable $namespaces, ModuleHandlerInte * clearCachedDefinitions() method. Only use cache tags when cached plugin * definitions should be cleared along with other, related cache entries. */ - public function setCacheBackend(CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, $cache_key_prefix, array $cache_tags = array()) { - $this->languageManager = $language_manager; + public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key, array $cache_tags = array()) { $this->cacheBackend = $cache_backend; - $this->cacheKeyPrefix = $cache_key_prefix; - $this->cacheKey = $cache_key_prefix . ':' . $language_manager->getCurrentLanguage()->id; + $this->cacheKey = $cache_key; $this->cacheTags = $cache_tags; } @@ -178,13 +160,6 @@ public function clearCachedDefinitions() { // Use the cache tags to clear the cache. Cache::deleteTags($this->cacheTags); } - elseif ($this->languageManager) { - $cache_keys = array(); - foreach ($this->languageManager->getLanguages() as $langcode => $language) { - $cache_keys[] = $this->cacheKeyPrefix . ':' . $langcode; - } - $this->cacheBackend->deleteMultiple($cache_keys); - } else { $this->cacheBackend->delete($this->cacheKey); } diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php index 024eaeb42d36e0ff86bfb1a08918f26f92cd9d08..c9afe867ec54a30b032ad250bf9097c3cc7baa54 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php @@ -11,7 +11,6 @@ use Drupal\Component\Utility\String; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\TypedData\Validation\MetadataFactory; use Drupal\Core\Validation\ConstraintManager; @@ -53,14 +52,12 @@ class TypedDataManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { $this->alterInfo('data_type_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'typed_data_types_plugins'); + $this->setCacheBackend($cache_backend, 'typed_data_types_plugins'); parent::__construct('Plugin/DataType', $namespaces, $module_handler, 'Drupal\Core\TypedData\Annotation\DataType'); } diff --git a/core/lib/Drupal/Core/Validation/ConstraintManager.php b/core/lib/Drupal/Core/Validation/ConstraintManager.php index 612070cfe13eb2b3e2bff68c96f44ddc300ce7a3..94eed864d03399b7d446b193c9340b94aa4f5c80 100644 --- a/core/lib/Drupal/Core/Validation/ConstraintManager.php +++ b/core/lib/Drupal/Core/Validation/ConstraintManager.php @@ -10,8 +10,8 @@ use Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; +use Drupal\Core\StringTranslation\TranslationWrapper; /** * Constraint plugin manager. @@ -41,16 +41,14 @@ class ConstraintManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Validation/Constraint', $namespaces, $module_handler); $this->discovery = new StaticDiscoveryDecorator($this->discovery, array($this, 'registerDefinitions')); $this->alterInfo('validation_constraint'); - $this->setCacheBackend($cache_backend, $language_manager, 'validation_constraint_plugins'); + $this->setCacheBackend($cache_backend, 'validation_constraint_plugins'); } /** @@ -82,27 +80,27 @@ public function create($name, $options) { */ public function registerDefinitions() { $this->discovery->setDefinition('Null', array( - 'label' => t('Null'), + 'label' => new TranslationWrapper('Null'), 'class' => '\Symfony\Component\Validator\Constraints\Null', 'type' => FALSE, )); $this->discovery->setDefinition('NotNull', array( - 'label' => t('Not null'), + 'label' => new TranslationWrapper('Not null'), 'class' => '\Symfony\Component\Validator\Constraints\NotNull', 'type' => FALSE, )); $this->discovery->setDefinition('Blank', array( - 'label' => t('Blank'), + 'label' => new TranslationWrapper('Blank'), 'class' => '\Symfony\Component\Validator\Constraints\Blank', 'type' => FALSE, )); $this->discovery->setDefinition('NotBlank', array( - 'label' => t('Not blank'), + 'label' => new TranslationWrapper('Not blank'), 'class' => '\Symfony\Component\Validator\Constraints\NotBlank', 'type' => FALSE, )); $this->discovery->setDefinition('Email', array( - 'label' => t('Email'), + 'label' => new TranslationWrapper('Email'), 'class' => '\Symfony\Component\Validator\Constraints\Email', 'type' => array('string'), )); diff --git a/core/modules/aggregator/aggregator.services.yml b/core/modules/aggregator/aggregator.services.yml index 08347a65f55b29af35a08bb460edc5ef4808f452..930b9451089ec783789f738f1e87947f2282725f 100644 --- a/core/modules/aggregator/aggregator.services.yml +++ b/core/modules/aggregator/aggregator.services.yml @@ -1,13 +1,13 @@ services: plugin.manager.aggregator.fetcher: class: Drupal\aggregator\Plugin\AggregatorPluginManager - arguments: [fetcher, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [fetcher, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.aggregator.parser: class: Drupal\aggregator\Plugin\AggregatorPluginManager - arguments: [parser, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [parser, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.aggregator.processor: class: Drupal\aggregator\Plugin\AggregatorPluginManager - arguments: [processor, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [processor, '@container.namespaces', '@cache.discovery', '@module_handler'] aggregator.items.importer: class: Drupal\aggregator\ItemsImporter arguments: ['@config.factory', '@plugin.manager.aggregator.fetcher', '@plugin.manager.aggregator.parser', '@plugin.manager.aggregator.processor'] diff --git a/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php b/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php index 717d41c3fe86b00683c990a1bd86d21889bac392..84196cd17e570aeeb09eb5a15c92c5c2cd5b9a09 100644 --- a/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php +++ b/core/modules/aggregator/src/Plugin/AggregatorPluginManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -27,12 +26,10 @@ class AggregatorPluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { $type_annotations = array( 'fetcher' => 'Drupal\aggregator\Annotation\AggregatorFetcher', 'parser' => 'Drupal\aggregator\Annotation\AggregatorParser', @@ -40,7 +37,7 @@ public function __construct($type, \Traversable $namespaces, CacheBackendInterfa ); parent::__construct("Plugin/aggregator/$type", $namespaces, $module_handler, $type_annotations[$type]); - $this->setCacheBackend($cache_backend, $language_manager, 'aggregator_' . $type . '_plugins'); + $this->setCacheBackend($cache_backend, 'aggregator_' . $type . '_plugins'); } } diff --git a/core/modules/block/block.services.yml b/core/modules/block/block.services.yml index 51acbfc0089806c5350965accf912285847959e5..bacc48e2d4c81ac7739a22dfb24fac5836a406ec 100644 --- a/core/modules/block/block.services.yml +++ b/core/modules/block/block.services.yml @@ -1,7 +1,7 @@ services: plugin.manager.block: class: Drupal\block\BlockManager - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', '@string_translation'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@string_translation'] theme.negotiator.block.admin_demo: class: Drupal\block\Theme\AdminDemoNegotiator tags: diff --git a/core/modules/block/src/BlockManager.php b/core/modules/block/src/BlockManager.php index 1db10a6f9b5628b36cd1a042273f3135520066b1..706af511b69a1e98a277f609b4fee30d40700858 100644 --- a/core/modules/block/src/BlockManager.php +++ b/core/modules/block/src/BlockManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\StringTranslation\TranslationInterface; @@ -42,18 +41,16 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation * The translation manager. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler, TranslationInterface $string_translation) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, TranslationInterface $string_translation) { parent::__construct('Plugin/Block', $namespaces, $module_handler, 'Drupal\block\Annotation\Block'); $this->alterInfo('block'); - $this->setCacheBackend($cache_backend, $language_manager, 'block_plugins'); + $this->setCacheBackend($cache_backend, 'block_plugins'); $this->stringTranslation = $string_translation; } diff --git a/core/modules/ckeditor/src/CKEditorPluginManager.php b/core/modules/ckeditor/src/CKEditorPluginManager.php index 677bf99d8bc397dfab4420a99e15930c7b1e75c9..57480216501491877784cce8a164776427ce7818 100644 --- a/core/modules/ckeditor/src/CKEditorPluginManager.php +++ b/core/modules/ckeditor/src/CKEditorPluginManager.php @@ -11,7 +11,6 @@ use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\editor\Entity\Editor; /** @@ -27,15 +26,13 @@ class CKEditorPluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/CKEditorPlugin', $namespaces, $module_handler, 'Drupal\ckeditor\Annotation\CKEditorPlugin'); $this->alterInfo('ckeditor_plugin_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'ckeditor_plugins'); + $this->setCacheBackend($cache_backend, 'ckeditor_plugins'); } /** diff --git a/core/modules/config_translation/src/ConfigMapperManager.php b/core/modules/config_translation/src/ConfigMapperManager.php index 04e15071c657f731e9c6e66bc2b2f869fabfb85c..2fb25682182375d1c6d68cec17f7b9a22e298696 100644 --- a/core/modules/config_translation/src/ConfigMapperManager.php +++ b/core/modules/config_translation/src/ConfigMapperManager.php @@ -97,7 +97,9 @@ public function __construct(CacheBackendInterface $cache_backend, LanguageManage $this->themeHandler = $theme_handler; $this->alterInfo('config_translation_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'config_translation_info_plugins'); + // Config translation only uses an info hook discovery, cache by language. + $cache_key = 'config_translation_info_plugins' . ':' . $language_manager->getCurrentLanguage()->getId(); + $this->setCacheBackend($cache_backend, $cache_key, array('config_translation_info_plugins' => TRUE)); } /** diff --git a/core/modules/editor/src/Plugin/EditorManager.php b/core/modules/editor/src/Plugin/EditorManager.php index adf16e5cf69f48a31e046d517dd4dad66f67de91..8c9dd9276b839ad6c0d3c6dbdc5ee7193dd00b87 100644 --- a/core/modules/editor/src/Plugin/EditorManager.php +++ b/core/modules/editor/src/Plugin/EditorManager.php @@ -10,7 +10,6 @@ use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; /** * Configurable text editor manager. @@ -25,15 +24,13 @@ class EditorManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Editor', $namespaces, $module_handler, 'Drupal\editor\Annotation\Editor'); $this->alterInfo('editor_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'editor_plugins'); + $this->setCacheBackend($cache_backend, 'editor_plugins'); } /** diff --git a/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php b/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php index 6ca37c91735953714fdeecf2a023af447d097ffc..aa44f1cfdb5ee5f30e0e015c44a3f4708dcb9440 100644 --- a/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php +++ b/core/modules/entity_reference/src/Plugin/Type/SelectionPluginManager.php @@ -13,7 +13,6 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\entity_reference\Plugin\Type\Selection\SelectionBroken; @@ -26,7 +25,7 @@ class SelectionPluginManager extends DefaultPluginManager { /** * {@inheritdoc} */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { $this->discovery = new AnnotatedClassDiscovery('Plugin/entity_reference/selection', $namespaces, 'Drupal\entity_reference\Annotation\EntityReferenceSelection'); // We're not using the parent constructor because we use a different factory @@ -35,7 +34,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac $this->moduleHandler = $module_handler; $this->alterInfo('entity_reference_selection'); - $this->setCacheBackend($cache_backend, $language_manager, 'entity_reference_selection_plugins'); + $this->setCacheBackend($cache_backend, 'entity_reference_selection_plugins'); } /** diff --git a/core/modules/filter/src/FilterPluginManager.php b/core/modules/filter/src/FilterPluginManager.php index 6f7a133004f14058a1a10bc8c0664e7c05e3743d..de075af603d409879dbd216c1700003d03c279e7 100644 --- a/core/modules/filter/src/FilterPluginManager.php +++ b/core/modules/filter/src/FilterPluginManager.php @@ -7,15 +7,9 @@ namespace Drupal\filter; -use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; -use Drupal\Core\Plugin\Discovery\AlterDecorator; -use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; -use Drupal\Core\Plugin\Discovery\CacheDecorator; -use Drupal\Core\Plugin\Factory\ContainerFactory; /** * Manages text processing filters. @@ -32,15 +26,13 @@ class FilterPluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Filter', $namespaces, $module_handler, 'Drupal\filter\Annotation\Filter'); $this->alterInfo('filter_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'filter_plugins', array('filter_formats' => TRUE)); + $this->setCacheBackend($cache_backend, 'filter_plugins', array('filter_formats' => TRUE)); } /** diff --git a/core/modules/image/src/ImageEffectManager.php b/core/modules/image/src/ImageEffectManager.php index f025c76d5a12d8b93ff81f80e6836fb8841377fc..48854500899776f14c8ab8bdae6f945f1c246a7c 100644 --- a/core/modules/image/src/ImageEffectManager.php +++ b/core/modules/image/src/ImageEffectManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -25,16 +24,14 @@ class ImageEffectManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/ImageEffect', $namespaces, $module_handler, 'Drupal\image\Annotation\ImageEffect'); $this->alterInfo('image_effect_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'image_effect_plugins'); + $this->setCacheBackend($cache_backend, 'image_effect_plugins'); } } diff --git a/core/modules/migrate/migrate.services.yml b/core/modules/migrate/migrate.services.yml index 135b63a270d749c51197d485f5d6d4a9365e5b81..e51e1f316b0204237e488acd591c936decbfd217 100644 --- a/core/modules/migrate/migrate.services.yml +++ b/core/modules/migrate/migrate.services.yml @@ -8,19 +8,19 @@ services: arguments: [migrate] plugin.manager.migrate.source: class: Drupal\migrate\Plugin\MigratePluginManager - arguments: [source, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource'] + arguments: [source, '@container.namespaces', '@cache.discovery', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource'] plugin.manager.migrate.process: class: Drupal\migrate\Plugin\MigratePluginManager - arguments: [process, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin'] + arguments: [process, '@container.namespaces', '@cache.discovery', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin'] plugin.manager.migrate.destination: class: Drupal\migrate\Plugin\MigrateDestinationPluginManager - arguments: [destination, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', '@entity.manager'] + arguments: [destination, '@container.namespaces', '@cache.discovery', '@module_handler', '@entity.manager'] plugin.manager.migrate.id_map: class: Drupal\migrate\Plugin\MigratePluginManager - arguments: [id_map, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [id_map, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.migrate.entity_field: class: Drupal\migrate\Plugin\MigratePluginManager - arguments: [entity_field, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [entity_field, '@container.namespaces', '@cache.discovery', '@module_handler'] password_migrate: class: Drupal\migrate\MigratePassword arguments: ['@password_original'] diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php index 9e8779582b4c29b3b5195ff8f2667d94712b232a..c90bddd7ca0ed8e53df27d5ee72cc5ebb5d01098 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php @@ -11,8 +11,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Extension\ThemeHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\migrate\Entity\MigrationInterface; class MigrateDestinationPluginManager extends MigratePluginManager { @@ -34,8 +32,8 @@ class MigrateDestinationPluginManager extends MigratePluginManager { /** * {@inheritdoc} */ - public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') { - parent::__construct($type, $namespaces, $cache_backend, $language_manager, $module_handler, $annotation); + public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') { + parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation); $this->entityManager = $entity_manager; } diff --git a/core/modules/migrate/src/Plugin/MigratePluginManager.php b/core/modules/migrate/src/Plugin/MigratePluginManager.php index ece8f2aa873b2553564151f30356d27866f00a51..76a787b47e8fd2120c5fcc70e46812f5ed25145f 100644 --- a/core/modules/migrate/src/Plugin/MigratePluginManager.php +++ b/core/modules/migrate/src/Plugin/MigratePluginManager.php @@ -8,13 +8,10 @@ namespace Drupal\migrate\Plugin; use Drupal\Component\Plugin\Factory\DefaultFactory; -use Drupal\Component\Utility\String; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\migrate\Entity\MigrationInterface; -use Drupal\migrate\MigrateException; /** * Manages migrate plugins. @@ -34,17 +31,15 @@ class MigratePluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. * @param string $annotation * The annotation class name. */ - public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\Component\Annotation\PluginID') { + public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\Component\Annotation\PluginID') { parent::__construct("Plugin/migrate/$type", $namespaces, $module_handler, $annotation); $this->alterInfo('migrate_' . $type . '_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'migrate_plugins_' . $type); + $this->setCacheBackend($cache_backend, 'migrate_plugins_' . $type); } /** diff --git a/core/modules/migrate_drupal/migrate_drupal.services.yml b/core/modules/migrate_drupal/migrate_drupal.services.yml index f853763656599283ad7ebf6f5c1744c8d6c3e5d8..6dd03c06117e759e56482e1bcb6e789c435264a7 100644 --- a/core/modules/migrate_drupal/migrate_drupal.services.yml +++ b/core/modules/migrate_drupal/migrate_drupal.services.yml @@ -1,4 +1,4 @@ services: plugin.manager.migrate.load: class: Drupal\migrate\Plugin\MigratePluginManager - arguments: [load, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [load, '@container.namespaces', '@cache.discovery', '@module_handler'] diff --git a/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php b/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php index f4e9e9586d33a50428e490f7fe7c345de9ca7035..d89c82ad40dd2d6b097c1fadec8108fd21b334ef 100644 --- a/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php +++ b/core/modules/quickedit/src/Plugin/InPlaceEditorManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -27,15 +26,13 @@ class InPlaceEditorManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/InPlaceEditor', $namespaces, $module_handler, 'Drupal\quickedit\Annotation\InPlaceEditor'); $this->alterInfo('quickedit_editor'); - $this->setCacheBackend($cache_backend, $language_manager, 'quickedit:editor'); + $this->setCacheBackend($cache_backend, 'quickedit:editor'); } } diff --git a/core/modules/rest/rest.services.yml b/core/modules/rest/rest.services.yml index e7b43f3c5467f93778110f2a0a5129fc5d8aa9fb..6172047a6773837f058816e3b6c2f05b520a7443 100644 --- a/core/modules/rest/rest.services.yml +++ b/core/modules/rest/rest.services.yml @@ -1,7 +1,7 @@ services: plugin.manager.rest: class: Drupal\rest\Plugin\Type\ResourcePluginManager - arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: ['@container.namespaces', '@cache.discovery', '@module_handler'] cache.rest: class: Drupal\Core\Cache\CacheBackendInterface tags: diff --git a/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php b/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php index 64630ea03e85770dbd8a5dac6376a68c7efe305d..cb879903194a4e13c01272f20cf296bd985b3e12 100644 --- a/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php +++ b/core/modules/rest/src/Plugin/Type/ResourcePluginManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -25,15 +24,13 @@ class ResourcePluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/rest/resource', $namespaces, $module_handler, 'Drupal\rest\Annotation\RestResource'); - $this->setCacheBackend($cache_backend, $language_manager, 'rest_plugins'); + $this->setCacheBackend($cache_backend, 'rest_plugins'); $this->alterInfo('rest_resource'); } diff --git a/core/modules/search/src/SearchPluginManager.php b/core/modules/search/src/SearchPluginManager.php index 46418996789eadee1ea49d30a21ff57365243134..a7e22385a9fab23970a3d512bee0d1dd7a1d3f60 100644 --- a/core/modules/search/src/SearchPluginManager.php +++ b/core/modules/search/src/SearchPluginManager.php @@ -10,7 +10,6 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Language\LanguageManager; /** * SearchExecute plugin manager. @@ -25,15 +24,13 @@ class SearchPluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Search', $namespaces, $module_handler, 'Drupal\search\Annotation\SearchPlugin'); - $this->setCacheBackend($cache_backend, $language_manager, 'search_plugins'); + $this->setCacheBackend($cache_backend, 'search_plugins'); // @todo Set an alter hook. } diff --git a/core/modules/system/tests/modules/condition_test/src/FormController.php b/core/modules/system/tests/modules/condition_test/src/FormController.php index d783ecdb0e21f336a42959dfe66a78d33e67aa2b..d713bb769034c75c31b6d9c9c61dc66b25b1853e 100644 --- a/core/modules/system/tests/modules/condition_test/src/FormController.php +++ b/core/modules/system/tests/modules/condition_test/src/FormController.php @@ -33,7 +33,7 @@ public function getFormId() { * Constructs a \Drupal\condition_test\FormController object. */ public function __construct() { - $manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('discovery'), \Drupal::service('language_manager'), \Drupal::moduleHandler()); + $manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('discovery'), \Drupal::moduleHandler()); $this->condition = $manager->createInstance('node_type'); } diff --git a/core/modules/tour/src/TipPluginManager.php b/core/modules/tour/src/TipPluginManager.php index 32cf923357e46a6c5652a5cecbac9c0df754e001..bae40668a852f8e9db1c1d93b19cccde0f9406b8 100644 --- a/core/modules/tour/src/TipPluginManager.php +++ b/core/modules/tour/src/TipPluginManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; /** @@ -25,16 +24,14 @@ class TipPluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations, * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/tour/tip', $namespaces, $module_handler, 'Drupal\tour\Annotation\Tip'); $this->alterInfo('tour_tips_info'); - $this->setCacheBackend($cache_backend, $language_manager, 'tour_plugins'); + $this->setCacheBackend($cache_backend, 'tour_plugins'); } } diff --git a/core/modules/views/src/Plugin/ViewsHandlerManager.php b/core/modules/views/src/Plugin/ViewsHandlerManager.php index 3e6ec0522caa4426e7cf496071f9f14d7f7b649c..c3651cff6022f991f86799da3d5eeb71ab706f58 100644 --- a/core/modules/views/src/Plugin/ViewsHandlerManager.php +++ b/core/modules/views/src/Plugin/ViewsHandlerManager.php @@ -10,7 +10,6 @@ use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\views\ViewsData; use Symfony\Component\DependencyInjection\Container; @@ -48,16 +47,14 @@ class ViewsHandlerManager extends DefaultPluginManager { * The views data cache. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { $plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($handler_type); parent::__construct("Plugin/views/$handler_type", $namespaces, $module_handler, $plugin_definition_annotation_name); - $this->setCacheBackend($cache_backend, $language_manager, "views:$handler_type", array('extension' => array(TRUE, 'views'))); + $this->setCacheBackend($cache_backend, "views:$handler_type", array('extension' => array(TRUE, 'views'))); $this->viewsData = $views_data; $this->handlerType = $handler_type; diff --git a/core/modules/views/src/Plugin/ViewsPluginManager.php b/core/modules/views/src/Plugin/ViewsPluginManager.php index f4f4f0e52951c7910816dab2e0f18a1205f41bf7..386a4b3da32314fa1b14f5a1f920dfc33d963132 100644 --- a/core/modules/views/src/Plugin/ViewsPluginManager.php +++ b/core/modules/views/src/Plugin/ViewsPluginManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; use Symfony\Component\DependencyInjection\Container; @@ -28,12 +27,10 @@ class ViewsPluginManager extends DefaultPluginManager { * keyed by the corresponding namespace to look for plugin implementations, * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. - * @param \Drupal\Core\Language\LanguageManager $language_manager - * The language manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ - public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { + public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { $plugin_definition_annotation_name = 'Drupal\views\Annotation\Views' . Container::camelize($type); parent::__construct("Plugin/views/$type", $namespaces, $module_handler, $plugin_definition_annotation_name); @@ -44,7 +41,7 @@ public function __construct($type, \Traversable $namespaces, CacheBackendInterfa ); $this->alterInfo('views_plugins_' . $type); - $this->setCacheBackend($cache_backend, $language_manager, "views:{$type}_plugins", array('extension' => array(TRUE, 'views'))); + $this->setCacheBackend($cache_backend, "views:{$type}_plugins", array('extension' => array(TRUE, 'views'))); } } diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml index 66172c7c131d3f16d32e872833f0c5458aaa1c31..b66568f0ffd0f8b75882dee23a6891de9aa7960c 100644 --- a/core/modules/views/views.services.yml +++ b/core/modules/views/views.services.yml @@ -1,61 +1,61 @@ services: plugin.manager.views.access: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [access, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [access, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.area: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.argument: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.argument_default: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [argument_default, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [argument_default, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.argument_validator: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [argument_validator, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [argument_validator, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.cache: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [cache, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [cache, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.display_extender: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [display_extender, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [display_extender, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.display: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [display, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [display, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.exposed_form: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [exposed_form, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [exposed_form, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.field: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.filter: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.join: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.pager: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [pager, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [pager, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.query: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [query, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [query, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.relationship: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.row: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [row, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [row, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.sort: class: Drupal\views\Plugin\ViewsHandlerManager - arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@module_handler'] plugin.manager.views.style: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [style, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [style, '@container.namespaces', '@cache.discovery', '@module_handler'] plugin.manager.views.wizard: class: Drupal\views\Plugin\ViewsPluginManager - arguments: [wizard, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler'] + arguments: [wizard, '@container.namespaces', '@cache.discovery', '@module_handler'] views.views_data: class: Drupal\views\ViewsData arguments: ['@cache.discovery', '@config.factory', '@module_handler', '@language_manager'] diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index 006948829703ba06e17c3ebb20625bf0f3154c30..c65883c225ac3075f2920b45b02d3a475695352d 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -556,11 +556,11 @@ public function testGetBaseFieldDefinitionsWithCaching() { ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(1)) ->method('get') - ->with('entity_type::en', FALSE) + ->with('entity_type', FALSE) ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(2)) ->method('set') - ->with('entity_type::en'); + ->with('entity_type'); $this->cache->expects($this->at(3)) ->method('set') ->with('entity_base_field_definitions:test_entity_type:en'); @@ -594,7 +594,7 @@ public function testGetFieldDefinitionsWithCaching() { ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(2)) ->method('get') - ->with('entity_type::en', FALSE) + ->with('entity_type', FALSE) ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(3)) ->method('set'); @@ -653,11 +653,11 @@ public function testGetFieldStorageDefinitionsWithCaching() { ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(2)) ->method('get') - ->with('entity_type::en', FALSE) + ->with('entity_type', FALSE) ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(3)) ->method('set') - ->with('entity_type::en'); + ->with('entity_type'); $this->cache->expects($this->at(4)) ->method('set') ->with('entity_field_storage_definitions:test_entity_type:en'); @@ -880,11 +880,11 @@ public function testGetAllBundleInfo() { ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(1)) ->method('get') - ->with("entity_type::en", FALSE) + ->with("entity_type", FALSE) ->will($this->returnValue(FALSE)); $this->cache->expects($this->at(2)) ->method('set') - ->with("entity_type::en"); + ->with("entity_type"); $this->cache->expects($this->at(3)) ->method('set') ->with("entity_bundle_info:en"); diff --git a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php index da65a2f64b08aa18fe133efd0ba1e1484f742d82..a77cc77c29e865474b2f39d05586994fb48f17da 100644 --- a/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php +++ b/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php @@ -35,10 +35,6 @@ public function setUp() { $namespaces = new \ArrayObject(); $namespaces["Drupal\\$module_name"] = $module_dir . '/src'; - $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $language_manager->expects($this->once()) - ->method('getCurrentLanguage') - ->will($this->returnValue(new Language(array('id' => 'en')))); $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); $module_handler->expects($this->once()) ->method('moduleExists') @@ -47,7 +43,6 @@ public function setUp() { $plugin_manager = new FieldTypePluginManager( $namespaces, $this->getMock('Drupal\Core\Cache\CacheBackendInterface'), - $language_manager, $module_handler ); diff --git a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php index 9ef8d20ab2d31c3e6135295778e93ee4afb04bfa..f85f4448dc14f7cc584531afa5afe83e38157419 100644 --- a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php @@ -27,13 +27,6 @@ class MailManagerTest extends UnitTestCase { */ protected $cache; - /** - * The language manager. - * - * @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $languageManager; - /** * The module handler. * @@ -90,11 +83,6 @@ protected function setUp() { // Prepare the default constructor arguments required by MailManager. $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); - $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $this->languageManager->expects($this->any()) - ->method('getCurrentLanguage') - ->will($this->returnValue((object) array('id' => 'en'))); - $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); // Mock a Discovery object to replace AnnotationClassDiscovery. @@ -113,7 +101,7 @@ protected function setUpMailManager($interface = array()) { 'interface' => $interface, ))); // Construct the manager object and override its discovery. - $this->mailManager = new TestMailManager(new \ArrayObject(), $this->cache, $this->languageManager, $this->moduleHandler, $this->configFactory); + $this->mailManager = new TestMailManager(new \ArrayObject(), $this->cache, $this->moduleHandler, $this->configFactory); $this->mailManager->setDiscovery($this->discovery); } diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php index 215060607022bd2034244d87cec8d9e330b048df..7ca082a8ed2b02f0bd35d6c839dbdcaaee20b59a 100644 --- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php @@ -133,7 +133,7 @@ protected function setUp() { $method->setAccessible(TRUE); $method->invoke($this->contextualLinkManager, 'contextual_links_plugins'); - $this->contextualLinkManager->setCacheBackend($this->cacheBackend, $language_manager, 'contextual_links_plugins'); + $this->contextualLinkManager->setCacheBackend($this->cacheBackend, 'contextual_links_plugins:en'); } /** diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php index d1675675a4d87e6fcb175baa9baa877667ed0d9a..16bf072bc58c797ed23baa0cdd5e533e6b35529e 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php @@ -13,7 +13,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\Language; -use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Menu\LocalActionManager; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Session\AccountInterface; @@ -67,13 +66,6 @@ class LocalActionManagerTest extends UnitTestCase { */ protected $cacheBackend; - /** - * The mocked language manager. - * - * @var \Drupal\Core\Language\LanguageManagerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $languageManager; - /** * The mocked access manager. * @@ -129,12 +121,6 @@ protected function setUp() { $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface'); $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); - $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $this->languageManager->expects($this->any()) - ->method('getCurrentLanguage') - ->will($this->returnValue( - new Language(array('langcode' => 'en')) - )); $this->accessManager = $this->getMockBuilder('Drupal\Core\Access\AccessManager') ->disableOriginalConstructor() @@ -143,7 +129,7 @@ protected function setUp() { $this->discovery = $this->getMock('Drupal\Component\Plugin\Discovery\DiscoveryInterface'); $this->factory = $this->getMock('Drupal\Component\Plugin\Factory\FactoryInterface'); - $this->localActionManager = new TestLocalActionManager($this->controllerResolver, $this->request, $this->routeProvider, $this->moduleHandler, $this->cacheBackend, $this->languageManager, $this->accessManager, $this->account, $this->discovery, $this->factory); + $this->localActionManager = new TestLocalActionManager($this->controllerResolver, $this->request, $this->routeProvider, $this->moduleHandler, $this->cacheBackend, $this->accessManager, $this->account, $this->discovery, $this->factory); } /** @@ -372,7 +358,7 @@ public function getActionsForRouteProvider() { class TestLocalActionManager extends LocalActionManager { - public function __construct(ControllerResolverInterface $controller_resolver, Request $request, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, AccessManager $access_manager, AccountInterface $account, DiscoveryInterface $discovery, FactoryInterface $factory) { + public function __construct(ControllerResolverInterface $controller_resolver, Request $request, RouteProviderInterface $route_provider, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache_backend, AccessManager $access_manager, AccountInterface $account, DiscoveryInterface $discovery, FactoryInterface $factory) { $this->discovery = $discovery; $this->factory = $factory; $this->routeProvider = $route_provider; @@ -383,7 +369,7 @@ public function __construct(ControllerResolverInterface $controller_resolver, Re $this->requestStack->push($request); $this->moduleHandler = $module_handler; $this->alterInfo('menu_local_actions'); - $this->setCacheBackend($cache_backend, $language_manager, 'local_action_plugins', array('local_action' => TRUE)); + $this->setCacheBackend($cache_backend, 'local_action_plugins', array('local_action' => TRUE)); } } diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php index 234c1f3aad51f504c5dd309379e3145562cc60ae..c620cc92c22a0b8839a52a422b48a64431750a42 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTest.php @@ -127,13 +127,8 @@ protected function getLocalTaskManager($module_dirs, $route_name, $route_params) $property->setAccessible(TRUE); $property->setValue($manager, $factory); - $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $language_manager->expects($this->any()) - ->method('getCurrentLanguage') - ->will($this->returnValue(new Language(array('id' => 'en')))); - $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); - $manager->setCacheBackend($cache_backend, $language_manager, 'local_task', array('local_task' => 1)); + $manager->setCacheBackend($cache_backend, 'local_task.en', array('local_task' => 1)); return $manager; } diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php index 282bf80d397b8def967202e1dbdc2f03c98c4afc..b612cf5543ca1bab4ccb353905ee3ba4f4043952 100644 --- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php @@ -291,7 +291,7 @@ protected function setupLocalTaskManager() { ->method('getCurrentLanguage') ->will($this->returnValue(new Language(array('id' => 'en')))); - $this->manager->setCacheBackend($this->cacheBackend, $language_manager, 'local_task', array('local_task' => 1)); + $this->manager->setCacheBackend($this->cacheBackend, 'local_task:en', array('local_task' => 1)); } /** diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index 95a64a95f5ae96678eb494478dfb92cbe5059ad3..b38da38679d855362399e2cbedb6f0f5746cf756 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -7,8 +7,6 @@ namespace Drupal\Tests\Core\Plugin; -use Drupal\Core\Language\Language; -use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; /** @@ -159,22 +157,15 @@ public function testDefaultPluginManagerWithEmptyCache() { $cache_backend ->expects($this->once()) ->method('get') - ->with($cid . ':en') + ->with($cid) ->will($this->returnValue(FALSE)); $cache_backend ->expects($this->once()) ->method('set') - ->with($cid . ':en', $this->expectedDefinitions); - - $language = new Language(array('id' => 'en')); - $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $language_manager->expects($this->once()) - ->method('getCurrentLanguage') - ->with(LanguageInterface::TYPE_INTERFACE) - ->will($this->returnValue($language)); + ->with($cid, $this->expectedDefinitions); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); - $plugin_manager->setCacheBackend($cache_backend, $language_manager, $cid); + $plugin_manager->setCacheBackend($cache_backend, $cid); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); $this->assertEquals($this->expectedDefinitions['banana'], $plugin_manager->getDefinition('banana')); @@ -191,21 +182,14 @@ public function testDefaultPluginManagerWithFilledCache() { $cache_backend ->expects($this->once()) ->method('get') - ->with($cid . ':en') + ->with($cid) ->will($this->returnValue((object) array('data' => $this->expectedDefinitions))); $cache_backend ->expects($this->never()) ->method('set'); - $language = new Language(array('id' => 'en')); - $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $language_manager->expects($this->once()) - ->method('getCurrentLanguage') - ->with(LanguageInterface::TYPE_INTERFACE) - ->will($this->returnValue($language)); - $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); - $plugin_manager->setCacheBackend($cache_backend, $language_manager, $cid); + $plugin_manager->setCacheBackend($cache_backend, $cid); $this->assertEquals($this->expectedDefinitions, $plugin_manager->getDefinitions()); } @@ -228,15 +212,8 @@ public function testCacheClearWithTags() { $this->getContainerWithCacheBins($cache_backend); - $language = new Language(array('id' => 'en')); - $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - $language_manager->expects($this->once()) - ->method('getCurrentLanguage') - ->with(LanguageInterface::TYPE_INTERFACE) - ->will($this->returnValue($language)); - $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); - $plugin_manager->setCacheBackend($cache_backend, $language_manager, $cid, array('tag' => TRUE)); + $plugin_manager->setCacheBackend($cache_backend, $cid, array('tag' => TRUE)); $plugin_manager->clearCachedDefinitions(); }