Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
bc7e413d
Commit
bc7e413d
authored
Jun 12, 2014
by
Nathaniel Catchpole
Browse files
Issue
#2281905
by Berdir: Stop caching plugin discovery/info hooks by language.
parent
8fd6225e
Changes
47
Hide whitespace changes
Inline
Side-by-side
core/core.services.yml
View file @
bc7e413d
...
...
@@ -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'
]
...
...
core/lib/Drupal/Core/Action/ActionManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
/**
...
...
core/lib/Drupal/Core/Archiver/ArchiverManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
/**
...
...
core/lib/Drupal/Core/Condition/ConditionManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
...
...
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
bc7e413d
...
...
@@ -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
;
...
...
core/lib/Drupal/Core/Field/FieldTypePluginManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
/**
...
...
core/lib/Drupal/Core/Field/FormatterPluginManager.php
View file @
bc7e413d
...
...
@@ -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
;
}
...
...
core/lib/Drupal/Core/Field/WidgetPluginManager.php
View file @
bc7e413d
...
...
@@ -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
);
...
...
core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php
View file @
bc7e413d
...
...
@@ -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
;
}
...
...
core/lib/Drupal/Core/Mail/MailManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
...
...
core/lib/Drupal/Core/Menu/ContextualLinkManager.php
View file @
bc7e413d
...
...
@@ -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
)
);
}
/**
...
...
core/lib/Drupal/Core/Menu/LocalActionManager.php
View file @
bc7e413d
...
...
@@ -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
));
}
/**
...
...
core/lib/Drupal/Core/Menu/LocalTaskManager.php
View file @
bc7e413d
...
...
@@ -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
));
}
/**
...
...
core/lib/Drupal/Core/Plugin/DefaultPluginManager.php
View file @
bc7e413d
...
...
@@ -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
);
}
...
...
core/lib/Drupal/Core/TypedData/TypedDataManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
...
...
core/lib/Drupal/Core/Validation/ConstraintManager.php
View file @
bc7e413d
...
...
@@ -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'
),
));
...
...
core/modules/aggregator/aggregator.services.yml
View file @
bc7e413d
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'
]
core/modules/aggregator/src/Plugin/AggregatorPluginManager.php
View file @
bc7e413d
...
...
@@ -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'
);
}
}
core/modules/block/block.services.yml
View file @
bc7e413d
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
:
...
...
core/modules/block/src/BlockManager.php
View file @
bc7e413d
...
...
@@ -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
;
}
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment