1 | <?php |
||
15 | trait DiscoveryTrait { |
||
16 | |||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | abstract public function getDefinitions(); |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | public function getDefinition($plugin_id, $exception_on_invalid = TRUE) { |
||
29 | |||
30 | /** |
||
31 | * Gets a specific plugin definition. |
||
32 | * |
||
33 | * @param array $definitions |
||
34 | * An array of the available plugin definitions. |
||
35 | * @param string $plugin_id |
||
36 | * A plugin id. |
||
37 | * @param bool $exception_on_invalid |
||
38 | * (optional) If TRUE, an invalid plugin ID will throw an exception. |
||
39 | * Defaults to FALSE. |
||
40 | * |
||
41 | * @return array|null |
||
42 | * A plugin definition, or NULL if the plugin ID is invalid and |
||
43 | * $exception_on_invalid is TRUE. |
||
44 | * |
||
45 | * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException |
||
46 | * Thrown if $plugin_id is invalid and $exception_on_invalid is TRUE. |
||
47 | */ |
||
48 | protected function doGetDefinition(array $definitions, $plugin_id, $exception_on_invalid) { |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function hasDefinition($plugin_id) { |
||
66 | |||
67 | } |
||
68 |