comparison core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Component\Plugin\Discovery;
4
5 /**
6 * A discovery mechanism that allows plugin definitions to be manually
7 * registered rather than actively discovered.
8 */
9 class StaticDiscovery implements DiscoveryInterface {
10
11 use DiscoveryCachedTrait;
12
13 /**
14 * {@inheritdoc}
15 */
16 public function getDefinitions() {
17 if (!$this->definitions) {
18 $this->definitions = [];
19 }
20 return $this->definitions;
21 }
22
23 /**
24 * Sets a plugin definition.
25 */
26 public function setDefinition($plugin, $definition) {
27 $this->definitions[$plugin] = $definition;
28 }
29
30 /**
31 * Deletes a plugin definition.
32 */
33 public function deleteDefinition($plugin) {
34 unset($this->definitions[$plugin]);
35 }
36
37 }