LimitedPluginDiscoveryDecorator.php in Plugin 8.2
File
src/PluginDiscovery/LimitedPluginDiscoveryDecorator.php
View source
<?php
namespace Drupal\plugin\PluginDiscovery;
class LimitedPluginDiscoveryDecorator extends PluginDiscoveryDecorator implements LimitedPluginDiscoveryInterface {
protected $discoveryLimit;
protected function processDecoratedDefinitions(array $decorated_definitions) {
if (is_array($this->discoveryLimit)) {
return array_intersect_key($decorated_definitions, array_flip($this->discoveryLimit));
}
else {
return $decorated_definitions;
}
}
public function setDiscoveryLimit(array $plugin_ids) {
$this->discoveryLimit = $plugin_ids;
return $this;
}
public function resetDiscoveryLimit() {
$this->discoveryLimit = NULL;
$this
->clearCachedDefinitions();
return $this;
}
}