Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace Drupal\Component\Plugin\Definition;
use Drupal\Component\Plugin\Context\ContextDefinitionInterface;
/**
* Provides an interface for plugin definitions which use contexts.
*
* @ingroup Plugin
*/
interface ContextAwarePluginDefinitionInterface extends PluginDefinitionInterface {
/**
* Checks if the plugin defines a particular context.
*
* @param string $name
* The context name.
*
* @return bool
* TRUE if the plugin defines the given context, otherwise FALSE.
*/
public function hasContextDefinition($name);
/**
* Returns all context definitions for this plugin.
*
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface[]
* The context definitions.
*/
public function getContextDefinitions();
/**
* Returns a particular context definition for this plugin.
*
* @param string $name
* The context name.
*
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
* The context definition.
*
* @throws \Drupal\Component\Plugin\Exception\ContextException
* Thrown if the plugin does not define the given context.
*/
public function getContextDefinition($name);
/**
* Adds a context to this plugin definition.
*
* @param string $name
* The context name.
* @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $definition
* The context definition.
*
* @return $this
* The called object.
*/
public function addContextDefinition($name, ContextDefinitionInterface $definition);
/**
* Removes a context definition from this plugin.
*
* @param string $name
* The context name.
*
* @return $this
* The called object.
*/
public function removeContextDefinition($name);
}