diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php index 6dc4163..44964c2 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php @@ -8,6 +8,7 @@ namespace Drupal\field\Plugin\Type\Formatter; use Drupal\Component\Plugin\PluginManagerBase; +use Drupal\Component\Plugin\Discovery\DefaultsDecorator; use Drupal\Core\Plugin\Discovery\CacheDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\field\Plugin\Type\Formatter\FormatterLegacyDiscoveryDecorator; @@ -19,14 +20,6 @@ class FormatterPluginManager extends PluginManagerBase { /** - * Overrides Drupal\Component\Plugin\PluginManagerBase:$defaults. - */ - protected $defaults = array( - 'settings' => array(), - 'default_value' => TRUE, - ); - - /** * The cache bin used for plugin definitions. * * @var string @@ -44,8 +37,12 @@ class FormatterPluginManager extends PluginManagerBase { * Constructs a FormatterPluginManager object. */ public function __construct() { - $this->baseDiscovery = new AlterDecorator(new FormatterLegacyDiscoveryDecorator(new AnnotatedClassDiscovery('field', 'formatter')), 'field_formatter_info'); - $this->discovery = new CacheDecorator($this->baseDiscovery, $this->cache_id, $this->cache_bin); + $defaults = array( + 'settings' => array(), + 'default_value' => TRUE, + ); + $base_discovery = new AlterDecorator(new DefaultsDecorator(new FormatterLegacyDiscoveryDecorator(new AnnotatedClassDiscovery('field', 'formatter')), $defaults), 'field_formatter_info'); + $this->discovery = new CacheDecorator($base_discovery, $this->cache_id, $this->cache_bin); $this->factory = new FormatterFactory($this); } diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php b/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php index e58ad4b..c0ec976 100644 --- a/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php +++ b/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php @@ -8,6 +8,7 @@ namespace Drupal\layout\Plugin\Type; use Drupal\Component\Plugin\PluginManagerBase; +use Drupal\Component\Plugin\Discovery\DefaultsDecorator; use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Component\Plugin\Factory\ReflectionFactory; @@ -17,16 +18,15 @@ */ class LayoutManager extends PluginManagerBase { - protected $defaults = array( - 'class' => 'Drupal\layout\Plugin\layout\layout\StaticLayout', - ); - /** * Overrides Drupal\Component\Plugin\PluginManagerBase::__construct(). */ public function __construct() { + $defaults = array( + 'class' => 'Drupal\layout\Plugin\layout\layout\StaticLayout', + ); // Create layout plugin derivatives from declaratively defined layouts. - $this->discovery = new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('layout', 'layout')); + $this->discovery = new DefaultsDecorator(new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('layout', 'layout')), $defaults); $this->factory = new ReflectionFactory($this); } }