From 8fcd8e605711bd707b531ef7618b4cc7d491989e Mon Sep 17 00:00:00 2001 From: catch Date: Wed, 15 Aug 2012 15:38:34 +0100 Subject: [PATCH] Issue #1722882 by aspilicious: Fixed Plugin CacheDecorator caches globally. --- .../Drupal/Core/Plugin/Discovery/CacheDecorator.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php index 49a0d2863d9..9df7ef66ee3 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php @@ -54,7 +54,7 @@ class CacheDecorator implements DiscoveryInterface { * @param string $cache_bin * The cache bin used for storage and retrieval of the definition list. */ - public function __construct(DiscoveryInterface $decorated, $cache_key, $cache_bin = 'default') { + public function __construct(DiscoveryInterface $decorated, $cache_key, $cache_bin = 'cache') { $this->decorated = $decorated; $this->cacheKey = $cache_key; $this->cacheBin = $cache_bin; @@ -64,14 +64,8 @@ class CacheDecorator implements DiscoveryInterface { * Implements Drupal\Component\Plugin\Discovery\DicoveryInterface::getDefinition(). */ public function getDefinition($plugin_id) { - $definitions = $this->getCachedDefinitions(); - if (isset($definitions)) { - $definition = isset($definitions[$plugin_id]) ? $definitions[$plugin_id] : NULL; - } - else { - $definition = $this->decorated->getDefinition($plugin_id); - } - return $definition; + $definitions = $this->getDefinitions(); + return isset($definitions[$plugin_id]) ? $definitions[$plugin_id] : array(); } /**