Mercurial > hg > cmmr2012-drupal-site
comparison core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.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 |
---|---|
2 | 2 |
3 namespace Drupal\Core\Plugin; | 3 namespace Drupal\Core\Plugin; |
4 | 4 |
5 use Drupal\Component\Plugin\Exception\PluginNotFoundException; | 5 use Drupal\Component\Plugin\Exception\PluginNotFoundException; |
6 use Drupal\Component\Plugin\LazyPluginCollection; | 6 use Drupal\Component\Plugin\LazyPluginCollection; |
7 use Drupal\Component\Plugin\PluginHelper; | |
7 use Drupal\Component\Plugin\PluginManagerInterface; | 8 use Drupal\Component\Plugin\PluginManagerInterface; |
8 use Drupal\Component\Plugin\ConfigurablePluginInterface; | |
9 use Drupal\Core\DependencyInjection\DependencySerializationTrait; | 9 use Drupal\Core\DependencyInjection\DependencySerializationTrait; |
10 | 10 |
11 /** | 11 /** |
12 * Provides a default plugin collection for a plugin type. | 12 * Provides a default plugin collection for a plugin type. |
13 * | 13 * |
110 // Reorder the instances to match the original order, adding new instances | 110 // Reorder the instances to match the original order, adding new instances |
111 // to the end. | 111 // to the end. |
112 $this->instanceIDs = $this->originalOrder + $current_order; | 112 $this->instanceIDs = $this->originalOrder + $current_order; |
113 | 113 |
114 foreach ($this as $instance_id => $instance) { | 114 foreach ($this as $instance_id => $instance) { |
115 if ($instance instanceof ConfigurablePluginInterface) { | 115 if (PluginHelper::isConfigurable($instance)) { |
116 $instances[$instance_id] = $instance->getConfiguration(); | 116 $instances[$instance_id] = $instance->getConfiguration(); |
117 } | 117 } |
118 else { | 118 else { |
119 $instances[$instance_id] = $this->configurations[$instance_id]; | 119 $instances[$instance_id] = $this->configurations[$instance_id]; |
120 } | 120 } |
156 * The plugin configuration to set. | 156 * The plugin configuration to set. |
157 */ | 157 */ |
158 public function setInstanceConfiguration($instance_id, array $configuration) { | 158 public function setInstanceConfiguration($instance_id, array $configuration) { |
159 $this->configurations[$instance_id] = $configuration; | 159 $this->configurations[$instance_id] = $configuration; |
160 $instance = $this->get($instance_id); | 160 $instance = $this->get($instance_id); |
161 if ($instance instanceof ConfigurablePluginInterface) { | 161 if (PluginHelper::isConfigurable($instance)) { |
162 $instance->setConfiguration($configuration); | 162 $instance->setConfiguration($configuration); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 /** | 166 /** |