Mercurial > hg > cmmr2012-drupal-site
comparison core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Core\Plugin; | 3 namespace Drupal\Core\Plugin; |
4 | 4 |
5 use Drupal\Component\Plugin\PluginHelper; | |
5 use Drupal\Component\Plugin\PluginManagerInterface; | 6 use Drupal\Component\Plugin\PluginManagerInterface; |
6 use Drupal\Component\Plugin\LazyPluginCollection; | 7 use Drupal\Component\Plugin\LazyPluginCollection; |
7 use Drupal\Component\Plugin\ConfigurablePluginInterface; | |
8 use Drupal\Core\DependencyInjection\DependencySerializationTrait; | 8 use Drupal\Core\DependencyInjection\DependencySerializationTrait; |
9 | 9 |
10 /** | 10 /** |
11 * Provides a default plugin collection for a plugin type. | 11 * Provides a default plugin collection for a plugin type. |
12 * | 12 * |
65 /** | 65 /** |
66 * {@inheritdoc} | 66 * {@inheritdoc} |
67 */ | 67 */ |
68 public function getConfiguration() { | 68 public function getConfiguration() { |
69 $plugin = $this->get($this->instanceId); | 69 $plugin = $this->get($this->instanceId); |
70 if ($plugin instanceof ConfigurablePluginInterface) { | 70 if (PluginHelper::isConfigurable($plugin)) { |
71 return $plugin->getConfiguration(); | 71 return $plugin->getConfiguration(); |
72 } | 72 } |
73 else { | 73 else { |
74 return $this->configuration; | 74 return $this->configuration; |
75 } | 75 } |
79 * {@inheritdoc} | 79 * {@inheritdoc} |
80 */ | 80 */ |
81 public function setConfiguration($configuration) { | 81 public function setConfiguration($configuration) { |
82 $this->configuration = $configuration; | 82 $this->configuration = $configuration; |
83 $plugin = $this->get($this->instanceId); | 83 $plugin = $this->get($this->instanceId); |
84 if ($plugin instanceof ConfigurablePluginInterface) { | 84 if (PluginHelper::isConfigurable($plugin)) { |
85 $plugin->setConfiguration($configuration); | 85 $plugin->setConfiguration($configuration); |
86 } | 86 } |
87 return $this; | 87 return $this; |
88 } | 88 } |
89 | 89 |